I have an generic class I made that I want to use for my managers that inherits from MonoBehaviour. Since all my managers work the same way it makes the most sense to me. I also have the EnemyManager attached to a gameobject in the world.
The problem though is I get this error "GameObject (named 'Managers') references runtime script in scene file. Fixing!"
What am I doing wrong? Any help would be appreciated.
Here is my code:
public class Managers where T : MonoBehaviour
{
public virtual void Awake()
{
}
public virtual void FixedUpdate()
{
}
public virtual void Add(T obj)
{
}
public virtual void Remove(int index)
{
}
public virtual void RemoveAllObjects()
{
}
}
public class EnemyManager : Managers
{
private static EnemyManager _instance;
public static EnemyManager Instance
{
get
{
return _instance;
}
}
public int MaxEnemies
{
get
{
return _maxEnemies;
}
}
[SerializeField]
[Range(0,100)]
private int _maxEnemies;
// Use this for initialization
public override void Awake()
{
base.Awake();
_instance = this;
}
public override void FixedUpdate()
{
base.FixedUpdate();
}
}
↧