Have created in “Resources” folder “Body.prefab” and “Obj.prefab”.
Body.Prefab Hirerarchy is
"Body" (GO with mesh)
|_"1st-Dummy" (GO without mesh)
|_"2nd-Dummy" (GO without mesh)
|_"3rd-Dummy" (GO without mesh)
|_"4th-Dummy" (GO without mesh)
need to get after instantiating
"Body" (GO with mesh)
|_Objects (Empty GO)
| |_first
| |_second
| |_third
| |_fourth
|
|_"1st-Dummy" (GO without mesh)
|_"2nd-Dummy" (GO without mesh)
|_"3rd-Dummy" (GO without mesh)
|_"4th-Dummy" (GO without mesh)
use JavaScript to instantiate Body prefab
var Body : GameObject;
var first : GameObject;
var second : GameObject;
var third : GameObject;
var fourth : GameObject;
function Start () {
Body = Instantiate(Resources.Load("Body.prefab", GameObject));
Body.Transform.Position = Vector3.Zero;
Body.Transform.Rotation = Quaternion.identity;
first = Instantiate(Resources.Load("Obj.prefab", GameObject));
}
- Can I load prefab and give it another name that propose me unity3d? (It calls “Body(clone)”, I want to call it “Body”)
- How Can I set transform position of first variable to child postion of 1st-Dummy of Body instantiated prefab.
- How can I to put first variable to be child of Body?
first.transform.position = Body.transform.Find("1st-Dummy").position;
– GizmoiThank you!
– LINKeRxUA