AnimationComplete() Error
so im watching this tutorial: link: https://www.youtube.com/watch?v=2XNP6Qf2gDU∈dex=7&list=PL_4rJ_acBNMH3SExL3yIOzaqj5IP5CJLC and I got to the part with the warp and ScreenFader but I keep getting this error: 'HUD' AnimationEvent 'AnimationComplete' has no receiver! Are you missing a component? I have little to no experience with C# or Unity but ill try to understand your responses as best I can.
this is my code For Screen Fader:
public class ScreenFader : MonoBehaviour {
Animator anim;
bool isFading = false;
// Use this for initialization
void Start ()
{
anim = GetComponent<Animator> ();
}
public IEnumerator FadeToClear()
{
isFading = true;
anim.SetTrigger ("FadeIn");
while (isFading)
yield return null;
}
public IEnumerator FadeToBlack()
{
isFading = true;
anim.SetTrigger ("FadeOut");
while (isFading)
yield return null;
}
void AnimationComplete()
{
isFading = false;
}
}
This is my code for Warp:
public class Warp : MonoBehaviour {
public Transform warpTarget;
IEnumerator OnTriggerEnter2D(Collider2D other)
{
ScreenFader sf = GameObject.FindGameObjectWithTag ("Fader").GetComponent<ScreenFader> ();
yield return StartCoroutine (sf.FadeToBlack ());
other.gameObject.transform.position = warpTarget.position;
Camera.main.transform.position = warpTarget.position;
yield return StartCoroutine (sf.FadeToClear() );
}
}
Im not exactly sure what i did wrong
Your answer
Follow this Question
Related Questions
How to remove flashing screen when changing Canvas Render Modes 0 Answers
Anim object with Relative Position 1 Answer
Trying to change an animation with a UI button 2 Answers
Beginner trying to add animation 0 Answers
C# GetKeyDown not working 3 Answers