One specific script won't appear as a component in the Inspector only in Game Mode??
I have a UnitBehavior script on a Unit prefab. In Game Mode, I can successfully instantiate the prefab and I know that the script works fine (I've logged the data that could only have been there if the script was running correctly), but the script component won't appear in the Inspector! And it's just that specific script. I've tried dropping it on other objects in the scene, and I've found that if I try to drop it on a static object while in Game Mode, when I end play, the script still won't be there. If I drop it on an object while in Scene Mode and then switch to Game Mode, the script component will disappear from the object for the duration of play, but will then reappear upon ending play.
It's very annoying, because I'm going to want to use that Inspector tool to keep track of variables and such. It's super early in development, so I really want to get this out of the way now. Has anyone encountered anything like this?
I'm adding the script in question, just on the off-chance there's something embedded within that's messing things up - not that there's much to it. It's just the only common denominator.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class UnitBehavior : MonoBehaviour
{
public UnitData unitData;
public int health;
private void Update()
{
if (health >= 0)
{
Kill();
}
}
public void SetValues()
{
this.health = unitData.health;
}
public void Kill()
{
Destroy(this);
}
}