Skip to content

Instantly share code, notes, and snippets.

@anzfactory
Last active February 9, 2016 06:23
Show Gist options
  • Save anzfactory/a0370593d32f6328ee33 to your computer and use it in GitHub Desktop.
Save anzfactory/a0370593d32f6328ee33 to your computer and use it in GitHub Desktop.
Script C# Templete For Unity => symbol replace https://gist.github.com/anzfactory/0f6d6c961d52e7651ff3
/*********************************
#CREATED#
*********************************/
using UnityEngine;
namespace #NAMESPACE#
{
public class #SCRIPTNAME# : MonoBehaviour
{
#region "Serialize Fields"
#endregion
#region "Fields"
#endregion
#region "Properties"
#endregion
#region "Events"
private void Awake()
{
}
private void Start ()
{
}
private void Update ()
{
}
private void FixedUpdate()
{
}
private void OnDestroy()
{
}
#endregion
#region "Public Methods"
#endregion
#region "Private Methods"
#endregion
}
}
/*********************************
#CREATED#
*********************************/
using UnityEngine;
namespace #NAMESPACE#
{
public class #SCRIPTNAME# : MonoBehaviour
{
#region "Singleton Pattern"
private static #SCRIPTNAME# sInstance;
public static #SCRIPTNAME# Instance
{
get { return #SCRIPTNAME#.GetInstance(); }
}
private static #SCRIPTNAME# GetInstance()
{
if (sInstance != null) {
return sInstance;
}
sInstance = FindObjectOfType<#SCRIPTNAME#>();
if (sInstance == null) {
GameObject gameObject = new GameObject("#SCRIPTNAME#");
sInstance = gameObject.AddComponent<#SCRIPTNAME#>();
}
return sInstance;
}
#endregion
#region "Serialize Fields"
#endregion
#region "Fields"
#endregion
#region "Properties"
#endregion
#region "Events"
private void Awake()
{
if (sInstance == null) {
sInstance = this;
DontDestroyOnLoad(this);
} else {
Destroy(this);
Destroy(this.gameObject);
}
}
private void Update()
{
}
private void FixedUpdate()
{
}
private void OnDestroy()
{
}
#endregion
#region "Public Methods"
#endregion
#region "Private Methods"
#endregion
}
}
/*********************************
#CREATED#
*********************************/
namespace #NAMESPACE#
{
public class #SCRIPTNAME#
{
#region "Fields"
#endregion
#region "Properties"
#endregion
#region "Constructor/Destructor"
public #SCRIPTNAME#()
{
}
~#SCRIPTNAME#()
{
}
#endregion
#region "Public Methods"
#endregion
#region "Private Methods"
#endregion
}
}
/*********************************
#CREATED#
*********************************/
namespace #NAMESPACE#
{
public class #SCRIPTNAME#
{
#region "Singleton Pattern"
private static #SCRIPTNAME# instance = new #SCRIPTNAME#();
public static #SCRIPTNAME# Instance
{
get { return instance; }
}
#endregion
#region "Fields"
#endregion
#region "Properties"
#endregion
#region "Constructor/Destructor"
private #SCRIPTNAME#()
{
}
~#SCRIPTNAME#()
{
}
#endregion
#region "Public Methods"
#endregion
#region "Private Methods"
#endregion
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment