示例#1
0
        public static T Instantiate <T>(PrefabFileInfos prefabInfo, Transform parent = null) where T : Component
        {
            GameObject gameObject = Object.Instantiate(PrefabFile.Load(prefabInfo.PrefabPath()), Vector3.get_zero(), Quaternion.get_identity()) as GameObject;

            if (gameObject == null)
            {
                return((T)((object)null));
            }
            if (parent != null)
            {
                gameObject.get_transform().set_parent(parent);
            }
            gameObject.get_transform().set_localScale(Vector3.get_one());
            return(gameObject.SafeGetComponent <T>());
        }
示例#2
0
 public static GameObject Instantiate(PrefabFileInfos prefabInfos, Transform parent = null)
 {
     return(PrefabFile.Instantiate(prefabInfos.PrefabPath(), parent));
 }
示例#3
0
 public static T Load <T>(PrefabFileInfos prefabInfos) where T : Component
 {
     return(Resources.Load <T>(string.Format("{0}/{1}", AppDataPath.PrefabFilePath, prefabInfos.PrefabPath())));
 }
示例#4
0
 public static T LoadAsync <T>(PrefabFileInfos prefabInfos) where T : Component
 {
     return((T)((object)Resources.LoadAsync <T>(string.Format("{0}/{1}", AppDataPath.PrefabFilePath, prefabInfos.PrefabPath())).get_asset()));
 }
示例#5
0
 public static GameObject LoadAsync(PrefabFileInfos prefabInfos)
 {
     return(Resources.LoadAsync(string.Format("{0}/{1}", AppDataPath.PrefabFilePath, prefabInfos.PrefabPath())).get_asset() as GameObject);
 }