Weapon Pickup Issues

Updated on January 4, 2019 in [A] Unity Scripting
Share on Facebook0Tweet about this on TwitterShare on Google+0Share on Reddit0
0 on January 4, 2019

Hello. I’m trying to make a 2D game in which there is a weapon which i can pick up and shoot. However, the weapon script makes it so that when i click mouse0 for “fire1”, it shoots a raycast even if i have not picked it up and it is still on the ground.

  1. I was thinking of duplicating the gun and making one of them a child object of my player, and once my player runs into the gun, i could disable the gun on the floor and enable to the gun in my hand.
  2. Another option i was thinking about was to disable the shooting script unless i had picked the gun up.

I am fairly new to unity and have been following tutorials on how to do things, never really straying far away from the instructor’s code. However, i am at the point where i want to make my game more unique but i cant find any tutorials for the goals i am trying to achieve. 

I need some help to solve this issue, any way to solve it or some help with the options above.


  • Liked by