Unity获取GameObject单例

    private static TipsController m_Instance;
    public static TipsController Instance
    {
        get
        {
            if (m_Instance == null)
            {
                m_Instance = (TipsController)FindObjectOfType(typeof(TipsController));
            }
            if (!m_Instance)
            {
                Debug.LogError("TipsController could not find himself!");
            }
            return m_Instance;
        }
    }

相关推荐
©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页