• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
0
Question by Mufark · Feb 19, 2017 at 10:03 AM · beginnernot workingweaponequipholding

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?

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by IgorAherne · Feb 19, 2017 at 11:42 AM

Start(), not start()

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Mufark · Feb 19, 2017 at 11:43 AM 1
Share

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

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

98 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Needing help with my game i'm creating. 0 Answers

3rd person weapon equiping 1 Answer

Making a specific door open in a dungeon with multiple doors 1 Answer

how do i make a function called from another script repeat? 1 Answer

how to make bullet explode on impact? 0 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges