I’m having an issue with a script I’m working on. I have made it so that when the character enters a certain collider, the boolean is set to true, but when it is true, the character won’t instantiate the cube that i set within the variable. I’m pretty sure it’s a mistake in my coding, but I don’t know exactly what I’m doing wrong.
#pragma strict
var fireball : GameObject;
var ShootFireballs = false;
function Start () {
}
function OnTriggerEnter (Other : Collider){
if(Other.gameObject.tag == "fireflower"){
ShootFireballs = true;
}
}
if (ShootFireballs == true) {
if(Input.GetKeyDown(KeyCode.E))
Instantiate(fireball, transform.position, Quaternion.identity);
}