unity awake function code example

Example 1: what does start() do unity

// The Start() function is called before the first frame
// You can use it to run any code you want right when the game starts
    
void Start()
{
	// Put any code you want here
    // Any code in here will run before the first frame of the game is called
}

Example 2: Start() Awake() Update()

Start()
{
	//Gets called on the first frame when the script is run
}
Update()
{
	//Gets called everyframe, for example if you wanted to 
    //increase a number every frame the do it here
}
Awake()
{
	//The same as start but can sometimes be more effiecient in some situations
}

Tags:

Misc Example