Hi guys,
Just wondering how I can make a derivable monobehaviour class.
If I do it like below, when i derive from it, my derived class won’t see any of it’s own functions because instance returns the base class not the derived class. What keyword should I be using instead of StaticMonoBehaviour here:
public static StaticMonoBehaviour instance;
Thanks,
Primoz
public class StaticMonoBehaviour : MonoBehaviour
{
public static StaticMonoBehaviour instance;
private void Awake()
{
if (instance == null)
{
instance = this;
}
else if (instance != this)
{
Destroy(gameObject);
}
}
}