Ejemplo n.º 1
0
 public GameObject LoadPrefab(string path, GameObject parent = null)
 {
     if (Application.platform == RuntimePlatform.WindowsEditor)
     {
         if (mRoot == null)
         {
             mRoot = GameObject.Instantiate(AssetDatabase.LoadAssetAtPath <GameObject>("Assets/Resource/Prefab/Root.prefab"));
         }
         if (parent == null)
         {
             return(Common.AddChild(mRoot, AssetDatabase.LoadAssetAtPath <GameObject>("Assets/Resource/Prefab/" + path + ".prefab")));
         }
         if (parent != null)
         {
             return(Common.AddChild(parent, AssetDatabase.LoadAssetAtPath <GameObject>("Assets/Resource/Prefab/" + path + ".prefab")));
         }
     }
     return(null);
 }