I have a gun and it shoots and all but when i drop it onto the floor and click shoot it still shoots how can i stop that?
When you hold the gun, it will be a child of something (hand or player or whatever). When you drop it, you presumably unparent it. If you do then transform.parent
will be null.
So test to see what the transform.parent
is.
Lots of ways, you could use a bool equipped on the gun script and then check if equipped when shooting.