Beispiel #1
0
    private void Refresh(bool removeOthers)
    {
        UWAPlatform.GUIWrapper wrapper = gameObject.GetComponent <UWAPlatform.GUIWrapper>();
        if (wrapper == null)
        {
            wrapper = gameObject.AddComponent <UWAPlatform.GUIWrapper>();
        }
        wrapper.ControlByPoco = ControlByPoco;

#if UNITY_EDITOR
        if (removeOthers)
        {
            Component[] coms = gameObject.GetComponents <Component>();
            for (int i = 0; i < coms.Length; i++)
            {
                if (coms[i] != null &&
                    coms[i] != this &&
                    coms[i] != wrapper &&
                    coms[i].GetType() != typeof(Transform))
                {
                    DestroyImmediate(coms[i]);
                }
            }
        }
#endif
    }
Beispiel #2
0
    void Awake()
    {
        UWAPlatform.GUIWrapper wrapper = gameObject.GetComponent <UWAPlatform.GUIWrapper>();
        if (wrapper == null)
        {
            wrapper = gameObject.AddComponent <UWAPlatform.GUIWrapper>();
        }

#if UNITY_EDITOR
        Component[] coms = gameObject.GetComponents <Component>();
        for (int i = 0; i < coms.Length; i++)
        {
            if (coms[i] != null &&
                coms[i] != this &&
                coms[i] != wrapper &&
                coms[i].GetType() != typeof(Transform))
            {
                DestroyImmediate(coms[i]);
            }
        }
#endif
    }