THANKS IN ADVANCE
Hi there i’m trying to write a script for my 2D RPG. in this script an object appears in front of the player, goes through an animation sequence before being destroyed however i am getting the smae three errors however i try to approach this. Hope u can help
heres the script:
using UnityEngine;
using System.Collections;
public class Freeze : MonoBehaviour {
private Animator anmtr;
private bool used;
// Use this for initialization
void Start () {
anmtr = GetComponent<Animator> ();
used = false;
}
// Update is called once per frame
IEnumerator Update () {
if (Input.GetKeyDown (KeyCode.Alpha1)) {
anmtr.SetBool ("freeze", true);
yield return new WaitForSeconds (1f);
anmtr.SetBool ("freeze", false);
used = true;
}
}
void SelfDestruct () {
if (used) {
Destroy (GameObject);
}
}
}
thanks again