单例-unity

2020-06-30  本文已影响0人  _Pman
    public static GameManager instance;

    private void Awake()
    {
        instance = this;
    }

或者定义属性Instance访问

    private static GameManager instance;

    public static GameManager Instance { get => instance; set => instance = value; }

    private void Awake()
    {
        Instance = this;
    }
上一篇下一篇

猜你喜欢

热点阅读