I’m very new to Unity and i’m trying to make a top-down space shooter. My collision script doesn’t work like i thought. Im trying to decrease enemy health but it gives me this error Assets/CollisionDamage.cs(12,33): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
using UnityEngine;
using System.Collections;
public class CollisionDamage : MonoBehaviour {
public int health = 1;
public int damage = 1;
void OnTriggerEnter2D(){
Debug.Log ("Trigger");
health-damage;
}
void Update() {
if (health <= 0) {
Die ();
}
}
void Die() {
Destroy (gameObject);
}
}