Exemplo n.º 1
0
        private static GameObjectCeil GetFromLoad(string path)
        {
            UnityEngine.Object obj = ResourceLoader.LoadObject(path, typeof(GameObject));
            if (null == obj)
            {
                return(null);
            }

            GameObject     target = GameObject.Instantiate(obj) as GameObject;
            GameObjectCeil ceil   = target.AddComponentIfNotExist <GameObjectCeil>();

            ceil.Init(path, Destroy);
            ceil.TheTransform.parent = m_root;
            return(ceil);
        }
Exemplo n.º 2
0
        private static void GetFromAysncLoad(string path, Action <GameObjectCeil> cb)
        {
            ResourceLoader.AsyncLoadObject(path, typeof(GameObject), (obj) =>
            {
                if (null == obj)
                {
                    cb?.Invoke(null);
                    return;
                }

                GameObject target   = GameObject.Instantiate(obj) as GameObject;
                GameObjectCeil ceil = target.AddComponentIfNotExist <GameObjectCeil>();
                ceil.Init(path, Destroy);
                ceil.TheTransform.parent = m_root;
                cb?.Invoke(ceil);
            });
        }