I'm working on a little game (which is also my first one) and I want to insert a splash screen at the beginning (after the Unity one). I've finally achieved to add a fade-in and a fade-out transistion when the splash screen starts and ends, but the fade out is activated by a button and I wont to play it simply after a certain time. I've made a script for that:
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
public class FadeInOut_2 : MonoBehaviour
{
public Animation anim;
IEnumerator Start()
{
yield return new WaitForSeconds(2f);
anim.GetComponent<Animation>().Play();
Application.LoadLevel(Application.loadedLevel + 1);
}
}
The problem is: when I try to attach the animation the Inspector refuses to do it.
Any ideas? Thanks
anim.Play();
\$\endgroup\$