Code error

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);

   }

}

This is for when start the first scene and after 2s will go to another scene,but why the code got error> like the (using) is not red in color.

and also “;” expected for the first line

whats wrong with the code???

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.