so im somewhat new to unity and i was wondering if i could do
OnCollisionEnter(Collision Col)
{
// this is the part i need help with
if(player.tag=Player)
{
Change int gunDamage +1
Destroy GameObject gunDamageUp
}
the name of the value i want to change is gunDamage
P.D. I have some recommendations on how you’re coding:
You should make sure that gunDamage and gunDamageUp variables are of type int and GameObject respectively and are declared on the same class in where the OnCollision method is being used.
Also, you need to make sure that the variable names that you’re using are descriptive enough of what you’re doing.
Finally, you can consider adding some comments to your code, because right now, it is impossible to know what you’re trying to accomplish inside of your if block.