📜  设置位于预制件中的转换的父级 - C# 代码示例

📅  最后修改于: 2022-03-11 14:49:19.444000             🧑  作者: Mango

代码示例1
//You might have tried to set the transform of the prefab as the child
//instead of the transform of the object you instantiated by accident.
GameObject name = (GameObject)Instantiate(namePrefab);
namePrefab.transform.parent = nameOfParent.transform; //Wrong
name.transform.parent = name.transform; //Correct