Scripting – Event Functions
•
•
Initialization Events:
–
void Start() – Is called on the frame when a script is enabled just before any of
the Update methods are called the first time.
–
void Awake() – is called when the script instance is being loaded. It is called when
the script object is initialized, regardless of whether or not the script is enabled.
Physics Events:
–
–
–
void OnCollisionEnter2D(Collision collision) – is called when the
collider/rigidbody has begun touching another rigidbody/collider.
void OnCollisionStay2D(Collision collision) – is called once per frame for every
collider/rigidbody that is touching the rigidbody/collider.
void OnCollisionExit2D(Collision collision) – is called when the collider/rigidbody
has stopped touching another rigidbody/collider.