You had a ‘.’ in the wrong place for the DisplayScene method…
IEnumerator.DisplayScene should be “IEnumerator DisplayScene”
using UnityEngine;
using System.Collections;
public class SplashScreen : MonoBehaviour {
public float timer = 2f;
public String levelToLoad = "Helicopter 1";
//use This for initializtion
void Start(){
StartCoroutine("DisplayScene");
}
IEnumerator DisplayScene(){
yield return new WaitForSeconds(timer);
Application.LoadLevel(levelToLoad);
}
}
Could this script being saved as SplashScreen.js instead of SplashScreen.cs? If the editor “thinks” this script isn’t C#, it will not highlight the using keyword, nor understand what it means - thus the error in the first line.
Another thing: in C# the string type is string, not String - this will produce another error.