コード例 #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(string path, Transform parent = null)
        {
            GameObject gameObject = Object.Instantiate(PrefabFile.Load(path), Vector3.get_zero(), Quaternion.get_identity()) as GameObject;

            if (gameObject == null)
            {
                return(null);
            }
            if (parent != null)
            {
                gameObject.get_transform().set_parent(parent);
            }
            gameObject.get_transform().set_localScale(Vector3.get_one());
            return(gameObject);
        }
コード例 #3
0
 public static GameObject Instantiate(PrefabFileInfos prefabInfos, Transform parent = null)
 {
     return(PrefabFile.Instantiate(prefabInfos.PrefabPath(), parent));
 }