namespace UnityModule { public abstract class Singleton where T : Singleton, new() { /// /// Singleton インスタンスの実体 /// private static T instance; /// /// Singleton インスタンス /// public static T Instance { get { if (instance == default(T)) { instance = new T(); instance.OnInitialize(); } return instance; } } /// /// 初期化時のコールバック /// protected virtual void OnInitialize() { // Do nothing. } } }