- Home /
 
Help with an error urgent
Basically, I have been trying this thing for ages and i think it might almost be working. I'm VERY new to unity and this is one of my first projects. I keep getting errors in my script but even when i fix it there still is no change? Here is my error: "Assets/Scripts/Pill/PillEnable.cs(33,30): error CS0119: Expression denotes a type', where a variable', value' or method group' was expected"
And here is my text:
 void Update () 
     {
         if (Input.GetKeyUp (KeyCode.E))
             Colliderr ();
         if (Input.GetKeyUp (KeyCode.E))
             Rendererr ();
         if (Input.GetKeyUp (KeyCode.E))
             FPS ();
         if (Input.GetKeyUp (KeyCode.E))
             Follower ();
     }
 
     void Colliderr()
     {
         StartCoroutine(Collider());
     }
     IEnumerator Collider()    
     {    
         //This is a coroutine
         GetComponent<CapsuleCollider>().enabled = false;
 
               "Here" yield return WaitForSeconds (20); //Wait one frame GetComponent().enabled = true; }
     void Rendererr()
     {
         StartCoroutine(Render());
     }
     IEnumerator Render()    
     {    
         //This is a coroutine
         GetComponent<MeshRenderer>().enabled = false;
 
               "Here" yield return WaitForSeconds (20); //Wait one frame GetComponent ().enabled = true; }
     void FPS()
     {
         StartCoroutine (FPSC ());
     }
     IEnumerator FPSC()
     {    
         //This is a coroutine
         GetComponent<PlayerController>().enabled = false;
 
               "Here" yield return WaitForSeconds (20); //Wait one frame GetComponent().enabled = true; }
     void Follower()
     {
         StartCoroutine (Follwer ());
     }
     IEnumerator Follwer()
     {    
         //This is a coroutine
         GetComponent<SphereFollower>().enabled = true;
 
               "Here" yield return WaitForSeconds (20); //Wait one frame GetComponent().enabled = false; } }
I have put the word "Here" is the lines that have the same error. Any help at all would be great!
Answer by tanoshimi · Jan 13, 2014 at 10:40 PM
For future reference, you don't need to insert "here" in your code - just paste the whole script and the error message and we can see from the line numbers where the problem is ;)
yield return WaitForSeconds (20); should be yield return new WaitForSeconds (20);
Thanks for the help, I can't believe how picky C# is o.0 I woulda voted your answer up, but i don't have enough rep yet :/
You're welcome. Also, you might not want to write "urgent" in your question title if it's going to take you 10 days to check for responses...
Answer by Sundar · Jan 13, 2014 at 10:44 PM
Add new in front of WaitForSeconds() like
 yield return new WaitForSeconds (20);
 
              Your answer
 
             Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Argument out of range. 1 Answer
NullReferenceException problem 2 Answers
Errors with script using Javascript. 2 Answers