@umm/singleton
Version:
Provide Singleton accessor to any class.
45 lines (26 loc) • 765 B
Markdown
* Singleton なアクセスを可能にする static アクセサを提供します。
* シンプルな Singleton 機構を作りたかったので作りました。
```shell
$ npm install github:umm-projects/singleton
```
```csharp
using UnityEngine;
using UnityModule;
public class SampleSingleton : Singleton<SampleSingleton> {
public string Hoge = "ほげ";
}
public class Sample {
public void Run() {
Debug.Log(SampleSingleton.Instance.Hoge);
}
}
```
* `Singleton<T>` を継承したクラスを作るだけです。
* `<T>` には作成するクラスをそのまま用います。
Copyright (c) 2017 Tetsuya Mori
Released under the MIT license, see [LICENSE.txt](LICENSE.txt)