Skip to content

Instantly share code, notes, and snippets.

@headcrab-company
Last active May 7, 2021 12:27
Show Gist options
  • Save headcrab-company/2cc1e4679795422e16c6b6edbbdcb97d to your computer and use it in GitHub Desktop.
Save headcrab-company/2cc1e4679795422e16c6b6edbbdcb97d to your computer and use it in GitHub Desktop.
This is my own version of Unity MonoBehavior script Template
#region Author
/////////////////////////////////////////
// YOUR NAME --> #SCRIPTNAME#
// Property of Headcrab
/////////////////////////////////////////
#endregion
using UnityEngine;
public class #SCRIPTNAME# : MonoBehaviour
{
#region Variables
#endregion Variables
///////////////////////////////////////////////////////////
#region Unity's functions
/// <summary>
/// Start is called before the first frame update
/// </summary>
private void Start()
{
CheckIfSetUp();
}
/// <summary>
/// Update is called once per frame
/// </summary>
private void Update()
{
}
#endregion Unity's functions
///////////////////////////////////////////////////////////
#region Functions
#endregion Functions
///////////////////////////////////////////////////////////
#region Accessors
#endregion Accessors
///////////////////////////////////////////////////////////
#region Utils
/// <summary>
/// Checks if all variables are set up correctly, otherwise close Editor
/// </summary>
private void CheckIfSetUp()
{
#if UNITY_EDITOR
bool isSetUp = true;
if (!randomVariable)
{
Debug.LogError($"<b>Random Variable</b> cannot be null in <color=#00f> {name} </color>", gameObject);
isSetUp = false;
}
UnityEditor.EditorApplication.isPlaying = isSetUp;
#endif
}
#endregion Utils
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment