创建预设体:把一个物体生成为预设体
PrefabUtility.CreatePrefab(路径,需要生成预设体的物体,替换预制(参数可更改));
PrefabUtility.CreatePrefab("Assets/myTest.prefab",myCube,ReplacePrefabOptions.ConnectToPrefab);
通过预设体动态创建物体
Game test1=(Game )Instantiate(Resources.Load("TestCube"));
Game test2=Game .Find("Sphere");
test1.transform.parent=test2.transform;
这个和上边的基本一样,自己看
Game test1=(Game )Instantiate(Resources.Load("TestCube"),transform.position,transform.rotation);
注意:使用预设体时,更改任何,都需要apply