I have a script to when i pickup the gameobjet with this script, it add 1 potion to my player, but i don't know why, it's adding 2 potions no matter how i change the value, it add always 2.
using UnityEngine;
using System.Collections;
public class PotionPickup : MonoBehaviour {
public int potionUp = 1;
void Start(){
}
void OnTriggerEnter (Collider other) {
if (!other.CompareTag("Player")) return;
FireButton.potion += potionUp;
Destroy (gameObject);
}
}
I don't know why but it is multiplying the value, if i set potionUp to 3, it give me 6,12,18.
↧