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.

There is no compiling error, but it just doesn't work, the functions are not called.

2 Answers

2

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.

[This blogspot on coroutines][1] might be able to help you [1]: http://www.blog.silentkraken.com/2010/01/23/coroutines-in-unity3d-c-version/

Built-in functions have to be capitalized. Use “Awake ()” and “Start ()” instead.

–David