I was going through the Space Shooter tutorial when I encountered this code. (in creating shots module)
using UnityEngine;
using System.Collections;
public class Mover : MonoBehaviour
{
public float speed;
void Start ()
{
rigidbody.velocity = transform.forward * speed;
}
}
The above code, when run in the editor, works i.e, it moves the bolt
forward each frame.
But how is it doing it since it is called in the Start()
?
Shouldn’t it be called only once? (as per the Execution Order Document?)
From the docs:
Before the first frame update
Start: Start is called before the
first frame update only if the script
instance is enabled.