Skip to content

Instantly share code, notes, and snippets.

@corycorvus
Last active October 11, 2017 06:15
Show Gist options
  • Select an option

  • Save corycorvus/f1636063b00940844cf28081594d1e9b to your computer and use it in GitHub Desktop.

Select an option

Save corycorvus/f1636063b00940844cf28081594d1e9b to your computer and use it in GitHub Desktop.
Unity MonoBehaviour Example
using UnityEngine;
// Unity MonoBehaviour Example
// MonoBehaviour is the base class from which every Unity script derives.
public class ExampleScript : MonoBehaviour
{
// Awake is called when the script instance is being loaded.
void Awake(){}
// Start is called on the frame when a script is enabled just before any of the Update methods is called the first time.
void Start(){}
// Update is called every frame, if the MonoBehaviour is enabled.
void Update(){}
// This function is called every fixed framerate frame, if the MonoBehaviour is enabled.
void FixedUpdate(){}
// LateUpdate is called every frame, if the Behaviour is enabled.
void LateUpdate(){}
// OnGUI is called for rendering and handling GUI events.
void OnGUI(){}
// This function is called when the behaviour becomes disabled () or inactive.
void OnDisable(){}
// This function is called when the object becomes enabled and active.
void OnEnabled(){}
// This function is called when the MonoBehaviour will be destroyed.
void OnDestroy() {}
// Sent to all GameObjects when the player gets or loses focus.
void OnApplicationFocus(bool hasFocus){}
// Sent to all GameObjects when the application pauses.
void OnApplicationPause(bool pauseStatus){}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment