I have borrowed this script in C#, which I attatch to my enemies. However, it keeps saying that there is a parsing error on the last line.
using UnityEngine;
using System.Collections;
public class EnemyHealth : MonoBehaviour {
public int maxHealth = 100;
public int curHealth = 100;
//initialization
void Start () { }
// Update
void Update () {
if (curHealth <1){
Destroy(gameObject);
}
}
void OnCollisionEnter(Collision col) {
if (col.gameObject.tag == "Bullet"){
curHealth -= 20;
Destroy(col.other);
}
}
↧