These are some that are missing (IMHO), so I thought I’d post them here. I’ll post more if I get the chance. I encourage others to post theirs as well.
How to get them to work is in this thread:
Generic GetComponent:
GetComponent <$type$>();
Instantiate:
$type$ $clone$ = ($type$)Instantiate($prefab$, $position$, $rotation$);
Require Component:
[RequireComponent (typeof ($type$))]
Singelton Support:
private static $type$ $id$;
// Reference Support
// This can be accessed with $id$.Instance.DoSomething();
// This can be cached by declaring private $type$ $id$;
// in Start() $id$ = $type$.Instance();
// Once cached, requires function calls as: $id$.DoSomething ();
public static $type$ Instance () {
if (! $id$) {
$id$ = FindObjectOfType(typeof ($type$)) as $type$;
if (! $id$)
Debug.LogError ("There needs to be one active $type$ script on a GameObject in your scene.");
}
return $id$;
}
Start Coroutine:
StartCoroutine($method$());
Using:
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
Add Menu:
[AddComponentMenu ("$root$/$path$")]
Another handy snippet that doesn’t need variables can be:
[System.Serializable]
… now this will complete normally, but if we make it a snippet, it should complete in one step not two.