I’m creating a basic health and damage script, and I was getting to the part where you declare the GameObject as dead. I have created a public GameObject variable, but it doesn’t seem to appear in the inspector, therefore not allowing me to assign a GameObject. I have checked other posts on this issue, but none of them resolved my issue. I dont have any addons or assets that would be messing with the way the inspector works, and from what I see there is nothing that should be conflicting with it.
using UnityEngine;
using System.Collections;
public class GunTarget : MonoBehaviour
{
public float health = 100f;
public GameObject EntityObject;
public void TakeDamage (float amount)
{
health -= amount;
if (health <= 0f)
{
Death();
}
}
public void Death()
{
Destroy(EntityObject);
}
}
my best guess is that it’s something to do with the “death” method, and not the GameObject itself. Any help would be appreciated, let me know if you need more information. Thank you in advance.