1.0.0 • Published 7 years ago

@umm/singleton v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
7 years ago

What?

  • Singleton なアクセスを可能にする static アクセサを提供します。

Why?

  • シンプルな Singleton 機構を作りたかったので作りました。

Install

$ npm install github:umm-projects/singleton

Usage

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> には作成するクラスをそのまま用います。

License

Copyright (c) 2017 Tetsuya Mori

Released under the MIT license, see LICENSE.txt