Quantcast
Channel: Questions in topic: "error"
Viewing all articles
Browse latest Browse all 7934

How to use a script on multiple gameobjects, then change a variable for one of them, but not the others VIA script?

$
0
0
So i'm making a 2d Shooter game with C#. and i've made multiple guns (for example a handgun and an assault rifle) , i attached the same script on both of these guns , and they both have the same variables but i changed them in the inspector so they have different characteristics. How can i change the assault rifle's Damage without interfering with the handgun , after meeting a certain condition in-game?. EXAMPLE: The assault rifle's damage is 50 , the handgun's is 30. the player buys an upgrade for the machine gun to increase its damage by 10, how can i change the rifle's damage without changing the handgun's damage?. i've looked for an answer for like 2 hours today and i've got nothing :(. Thanks for any help!!.

Viewing all articles
Browse latest Browse all 7934

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>