using UnityEngine
;
using System
.Collections
;
public class GiveParent : MonoBehaviour {
string fullPath
= "...";
void Start(){
GameObject tem
= new GameObject(Path
.GetFileNameWithoutExtension(fullPath
));
tem
.transform
.parent
= this.transform
;
}
}
在脚本中添加如上代码,并将脚本挂到父对象上即可。对于已存在的两个对象,也可通过transform变量设置对象的继承关系。
转载请注明原文地址:https://blackberry.8miu.com/read-10901.html