FadeCanvas error when trying to import Convai into existing Unity 2022.3.20f1 project

Reply by leean1 | 2024-10-09 22:19:55

It seems to have installed

Reply by k3kalinix | 2024-10-09 22:20:04

Can i see a screenshot?

Reply by leean1 | 2024-10-09 22:20:31

Images:

Reply by k3kalinix | 2024-10-09 22:21:03

Good

Reply by k3kalinix | 2024-10-09 22:21:13

Can you uncomment it?

Reply by leean1 | 2024-10-09 22:21:44

The error comes back

Reply by k3kalinix | 2024-10-09 22:22:47

I see

Reply by k3kalinix | 2024-10-09 22:23:19

Can you show me this FadeInFadeOut method?

Reply by leean1 | 2024-10-09 22:24:49

it is supposed to be apart of the FadeCanvas file but this is what I have

using System.Collections;
using UnityEngine;

/// <summary>
/// Fades a canvas over time using a coroutine and a canvas group
/// </summary>
[RequireComponent(typeof(CanvasGroup))]
public class FadeCanvas : MonoBehaviour
{
    [Tooltip("The speed at which the canvas fades")]
    public float defaultDuration = 1.0f;

    public Coroutine CurrentRoutine { private set; get; } = null;

    private CanvasGroup canvasGroup = null;
    private float alpha = 0.0f;

    private float quickFadeDuration = 0.25f;

    private void Awake()
    {
        canvasGroup = GetComponent<CanvasGroup>();
    }

    public void StartFadeIn()
    {
        StopAllCoroutines();
        CurrentRoutine = StartCoroutine(FadeIn(defaultDuration));
    }

    public void StartFadeOut()
    {
        StopAllCoroutines();
        CurrentRoutine = StartCoroutine(FadeOut(defaultDuration));
    }

    public void QuickFadeIn()
    {
        StopAllCoroutines();
        CurrentRoutine = StartCoroutine(FadeIn(quickFadeDuration));
    }

    public void QuickFadeOut()
    {
        StopAllCoroutines();
        CurrentRoutine = StartCoroutine(FadeOut(quickFadeDuration));
    }

    private IEnumerator FadeIn(float duration)
    {
        float elapsedTime = 0.0f;

        while (alpha <= 1.0f)
        {
            SetAlpha(elapsedTime / duration);
            elapsedTime += Time.deltaTime;
            yield return null;
        }
    }

    private IEnumerator FadeOut(float duration)
    {
        float elapsedTime = 0.0f;

        while (alpha >= 0.0f)
        {
            SetAlpha(1 - (elapsedTime / duration));
            elapsedTime += Time.deltaTime;
            yield return null;
        }
    }

    private void SetAlpha(float value)
    {
        alpha = value;
        canvasGroup.alpha = alpha;
    }
}

Reply by k3kalinix | 2024-10-09 22:26:05

Something is wrong

Reply by k3kalinix | 2024-10-09 22:26:44

I think there are two FadeCanvas

Reply by k3kalinix | 2024-10-09 22:27:02

Can you search FadeCanvas.cs ?

Reply by leean1 | 2024-10-09 22:28:04

I have three of them

Images:

Reply by k3kalinix | 2024-10-09 22:28:13

I see

Reply by leean1 | 2024-10-09 22:28:13

Images:

Reply by leean1 | 2024-10-09 22:28:21

Images:

Reply by k3kalinix | 2024-10-09 22:28:36

Second

Reply by k3kalinix | 2024-10-09 22:28:40

Double click

Reply by k3kalinix | 2024-10-09 22:28:52

Show me the Namespace

Reply by leean1 | 2024-10-09 22:29:44

Yep this one is the one from Convai and has the method that was missing in the other file namespace Convai.Scripts.Runtime.UI