描述:可用于任何预制件相关操作的实用程序类。
参考源:https://docs.unity.cn/cn/2019.4/ScriptReference/PrefabUtility.html
InstantiatePrefab
描述:将给定场景中的给定预制件实例化。
GameObject o = PrefabUtility.InstantiatePrefab(Selection.activeObject as GameObject) as GameObject;
public static Object InstantiatePrefab (Object assetComponentOrGameObject);
public static Object InstantiatePrefab (Object assetComponentOrGameObject,
SceneManagement.Scene destinationScene);
target | 要实例化的预制件资源。 |
---|---|
destinationScene | 要在其中实例化预制件的场景。 |