unity update only called once code example
Example 1: how to call something once in update
bool isDone = false;
void Update() {
if (!isDone) {
// put your code that runs once here
isDone = true;
}
}
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
}