I have a base class called “Mode” and I create a class called “NewMode” which extends off of “Mode”. “Mode” simply has a bunch of empty functions in it. I want to override these functions in “NewMode”.
static var CurrentMode: Mode;
static var CurrentObject: GameObject;
function Start()
{
CurrentObject = GameObject.Find("SomeObject");
if(CurrentObject != null)
{
CurrentMode = CurrentObject.GetComponent(NewModeScript);
CurrentMode.Enter();
}
}
NewModeScript contains the “NewMode” class. When I call CurrentMode.Enter() the empty function of the base class gets called.