How would I switch weapons?

Hey guys,

I’ve created a Unity project where my first person controller fires a gun with sound. I’m not sure how I would go about switching weapons in the game. Currently when I want to switch to a different weapon I have to swap models manually. How would one go about doing this?

Do I need to create an empty object called like “hands” or something and then use some code to switch models in and out?

There are 2 ways I can think of how to do this off the top of my head:

  • Have the character have all the gun models as children, deactivated or renderers disabled. When you want to switch, make the weapon you want to switch to appear, and the weapon you are currently on disappear.
  • Instantiate the gun model when switching and deleting the old gun.

That is really just the visual stuff though, switching the actual weapon really depends on how your system works. Have you looked at Unity Productions’ Bootcamp? I think you can find it in the Asset Store.

I’m definitely not interested in the first solution. I want the process of adding more items and weapons to my game to be as simple as possible. I’d much rather just have hand positions that the gun models fit into and can be loaded into the game. I’ll check out Bootcamp.

Thank you for replying.