upgrade pickups

hay guys, i was wondering if i could have some feedback on as to how to make upgrades, baiscly what i want is, when you pick up a secret item, it upgrades your fire rate of your gun. now i was thinking either making the var fire rate, to a boolean, would this work or how els could i do this?

I’d make a public variable of fireRate and when you collide with the upgrade object, just change that value to the upgrade value. (no extra boolean needed) This will let you have multiple upgrade/downgrade objects as well.

You can even stack the values if you wanted by checking to see how large it is, or just doing a += or -= to the fireRate variable.

Hope this helps some.

Another way is to save the values with PlayerPrefs, that’s my approach in my project. I don’t upgrade my fire rate, but I upograde my accuracy and I just get the accuracy value from PlayerPrefs and divide the actual accuracy of the gun with it. You can do the same with your fire rate.

thanks for the reply’s im going to go with caliber on this one though, i’ll have to do some searching in the docs.

var amountUpgraded = 10; 

function oncollisionenter()
{
gunscript.fireRate += amountUpgraded;
}