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>()); }
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); }