This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
public static class ExtensionMethods | |
{ | |
// Note: Making the parameter "this GameObject variableName" makes it an | |
// extension method for GameObject. Change it to Transform or whatever | |
// to make it a part of Transform, etc etc. | |
public static T GetOrAddComponent<T> (this GameObject obj) where T : Component | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
/// <summary> | |
/// Singleton manager base class. | |
/// </summary> | |
public class Singleton<T> : MonoBehaviour where T : Singleton<T> | |
{ | |
static T _instance; | |
public static T Instance |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using UnityEditor; | |
using UnityEditor.SceneManagement; | |
public class SceneSwitchWindow : EditorWindow | |
{ | |
[MenuItem("Window/Scene Switch Window")] | |
public static void ShowWindow () | |
{ | |
SceneSwitchWindow win = (SceneSwitchWindow)EditorWindow.GetWindow(typeof(SceneSwitchWindow)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEditor; | |
using UnityEngine; | |
/// <summary> | |
/// This window shows how you can listen for and consume user input events | |
/// from the Scene View. Super useful for making editor tools! | |
/// </summary> | |
public class SceneViewControlWindow : EditorWindow | |
{ | |
/// <summary> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Enumerators are auto-assigned values | |
// unless you specify them. Here "Agender" is -1, | |
// and then Woman is 0, Man is 1, etc. | |
public enum Gender | |
{ | |
Agender = -1, | |
Woman, | |
Man, | |
Neutral, |