- Home /
Enexpected Symbol Void (start)
Hi I am new to C# but I have checked and double checked and for some reason it says unexpected symbol void. (void Start)
using UnityEngine; using System.Collections; public class NewBehaviourScript2 : MonoBehaviour { int h = 1; void Start () { while(!h = 0) { Invoke ("nothing", 2); if (Input.GetKey (KeyCode.Space)) { renderer.enabled = !renderer.enabled; Invoke ("nothing", 2); } } } // Update is called once per frame void Update () { } }
Btw I also need help on having delays. Will what I did above work, or is there another command for adding delays?
Answer by YoungDeveloper · Jan 25, 2014 at 09:54 PM
While loop is not the same as update method. So input check should be used in update(). For delays use coroutines: http://answers.unity3d.com/questions/350721/c-yield-waitforseconds.html
Maybe you saved it as JS, or you didn't save it?
Your answer
Follow this Question
Related Questions
Initialising List array for use in a custom Editor 1 Answer
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Avoid function being called every frame (on Start void) 1 Answer
Unexpected symbol 'void' C# 1 Answer