- Home /
Question by
yusolaifdfer · Mar 31, 2013 at 07:03 AM ·
functionnot workingstartawake
awake and start functions not working
using UnityEngine;
using System.Collections;
public class lvl1_controller : MonoBehaviour {
public int collision_1 = 0;
// Use this for initialization
void awake () {
Debug.Log("awake");
}
void start () {
Debug.Log("Start");
}
IEnumerator start2 (){
yield return new WaitForSeconds(3);
Debug.Log("3 Secs pass");
}
// Update is called once per frame
void Update () {
// this works ~~ Debug.Log("updating");
}
}
The update function works. And no even if I remove the IEnumator it still doesn't works.
Comment
There is no compiling error, but it just doesn't work, the functions are not called.
Best Answer
Answer by Chronos-L · Mar 31, 2013 at 07:50 AM
It is void Awake()
and void Start()
not void awake()
and void start()
Function and class name : Capitalized, variable name : camel (Capitalized all but the first word)
Damn I feel dumb now. By the way, IEnumarator Start2 doesn't work, I guess multiple start functions are not available.
Answer by DavidDebnar · Mar 31, 2013 at 07:54 AM
Built-in functions have to be capitalized. Use "Awake ()" and "Start ()" instead.
--David