I have the following very simple code; the script is attached to my game character:
class NeuralNetController extends MonoBehaviour
{
function Start()
{
Debug.Log("Start called");
}
virtual function Update()
{
Debug.Log("Update called");
}
}
but it does not work - that is, neither method gets called. When I remove the class syntax, like this:
function Start()
{
Debug.Log("Start called");
}
virtual function Update()
{
Debug.Log("Update called");
}
then it works fine. Do I have the syntax wrong? Or should I extend from another class? Or is there something else going on?
Just as an experiment, I also added the virtual keywords to the function declaration of the first example; that too, did not work.
(If you are wondering why I don't simply use the second method - since it works - it is because I actually need to extend from another class that extends from MonoBehaviour. I just took out the irrelevant detail.)