What my script is supposed to do is have my "Matchbox" hit the "FirePit" and turn it on.
When my "Matchbox" hits the "Firepit" it does turn it on but it would stay on forever.
So I tried to add a timer to my script to run down when the "Firepit" got turned on and would eventually turn off. I keep getting this error under flame.SetActive = false;
(9,7) Expression 'self.flame.SetActive' cannot be assigned to.
#pragma strict
var myTimer : float = 5.0;
var flame : GameObject;
function Start () {
flame.SetActive = false;
}
function OnTriggerEnter (Col : Collider)
{
if(Col.tag == "Matches")
{
flame.SetActive = true;
}
}
function Update ()
{
if(flame.SetActive == false) {
myTimer -= Time.deltaTime;
}
if(myTimer <= 0){
flame.SetActive = false;
}
}
Thanks in advance if you decide to help me! :)
↧