Browse Source

Instantiate prefabs correctly (maintaining link)

master
chrisgregan 10 years ago
parent
commit
8c795496d5
  1. 2
      Assets/Fungus/Camera/Editor/CameraMenuItems.cs
  2. 2
      Assets/Fungus/Dialog/Editor/DialogMenuItems.cs
  3. 2
      Assets/Fungus/Sprite/Editor/SpriteMenuItems.cs

2
Assets/Fungus/Camera/Editor/CameraMenuItems.cs

@ -18,7 +18,7 @@ namespace Fungus
GameObject prefab = Resources.LoadAssetAtPath("Assets/Fungus/Camera/Prefabs/" + prefabName + ".prefab", typeof(GameObject)) as GameObject;
if (prefab != null)
{
GameObject go = GameObject.Instantiate(prefab) as GameObject;
GameObject go = PrefabUtility.InstantiatePrefab(prefab) as GameObject;
go.name = prefabName;
}
}

2
Assets/Fungus/Dialog/Editor/DialogMenuItems.cs

@ -43,7 +43,7 @@ namespace Fungus
GameObject prefab = Resources.LoadAssetAtPath("Assets/Fungus/Dialog/Prefabs/" + prefabName + ".prefab", typeof(GameObject)) as GameObject;
if (prefab != null)
{
GameObject go = GameObject.Instantiate(prefab) as GameObject;
GameObject go = PrefabUtility.InstantiatePrefab(prefab) as GameObject;
go.name = prefabName;
}
}

2
Assets/Fungus/Sprite/Editor/SpriteMenuItems.cs

@ -19,7 +19,7 @@ namespace Fungus
GameObject prefab = Resources.LoadAssetAtPath("Assets/Fungus/Sprite/Prefabs/" + prefabName + ".prefab", typeof(GameObject)) as GameObject;
if (prefab != null)
{
GameObject go = GameObject.Instantiate(prefab) as GameObject;
GameObject go = PrefabUtility.InstantiatePrefab(prefab) as GameObject;
go.name = prefabName;
}
}

Loading…
Cancel
Save