- Home /
Question by
Bincredible · Apr 04, 2013 at 10:54 PM ·
instantiatearrayparentbone
Parent my Weapon to the HandBone.
Hello, I was wondering if I could parent something I instantiate to a bone on the player. I can't do it, I have tried loads of things, but have all failed. Here is my code.
var WeaponArray : Transform[];
function OnGUI(){
if(GUI.Button(Rect(10,10,140,30),"ParentWeapon")){
WeaponFunction();
}
}
function WeaponFunction(){
Instantiate(WeaponArray[0],HandBone.position, HandBone.rotation);
//This is where I want to parent.
}
Comment
Answer by KMKxJOEY1 · Apr 05, 2013 at 12:27 AM
WeaponArray[0].transform.parent = GameObject.Find("/Character/Arm/Hand/").transform;
obvously fit the "/Character/Arm/Hand/" to what you want
Your answer
Follow this Question
Related Questions
onTrigger spawn object C# 3 Answers
What is the best way to instatiate an array of connected GameObjects? 0 Answers
Network.Instantiate is CHAOS. 1 Answer
UI LayoutGroup does not organize dynamically instantiated buttons 8 Answers
Instantiating gameobjects in an array / class problem | NullReferenceException: 0 Answers