Skip to content

Instantly share code, notes, and snippets.

@Marsgames
Last active March 23, 2021 17:48
Show Gist options
  • Save Marsgames/a26af659ceb1c17a7e26584672793faf to your computer and use it in GitHub Desktop.
Save Marsgames/a26af659ceb1c17a7e26584672793faf to your computer and use it in GitHub Desktop.
This is my own version of Unity MonoBehavior script Template
#region Author
/////////////////////////////////////////
// RAPHAEL DAUMAS --> #SCRIPTNAME#
// https://raphdaumas.wixsite.com/portfolio
// https://github.com/Marsgames
/////////////////////////////////////////
#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