Learning to equip weapons etc to character but its not working!
I bet you've seen it all before a million times. But I have scrolled through countless examples and tried with no change. I am currently beginner at both C# and unity.
I am trying to get my model to equip/hold a weapon when i start the game. I have created a child to the hand and turned off mesh and box collider.
I have then created the following C# script;
 public GameObject HookRightHand;
 void start(){
     GameObject sword = GameObject.Find ("sword-1");
     EquipMainHandWith (sword);
 }
 public void EquipMainHandWith(GameObject weapon){
     weapon.transform.parent = HookRightHand.transform;
     weapon.transform.localPosition = Vector3.zero;
 }
 
               }
I have then attached the child to the script which is name HookRightHand.
The weapon prefab is named sword-1, the model used is named sword_wooden. I have tried using both names with no luck.
Everytime i run the game the sword just sits in the air and doesn't follow as intended. What am i doing wrong? or what am i missing?
Answer by IgorAherne · Feb 19, 2017 at 11:42 AM
Start(), not start()
O$$anonymous$$FG! your the best...(Removed: I've) This has been doing my head in.
If your ever in $$anonymous$$elbourne I owe you a beer!!!
Edited: Because grammar and punctuation are important! Lol!
Your answer
 
             Follow this Question
Related Questions
how to make bullet explode on impact? 0 Answers
Object Reference not set to an instance of an object 0 Answers
Needing help with my game i'm creating. 0 Answers
Making a specific door open in a dungeon with multiple doors 1 Answer
Raycast shotgun help! 2 Answers