MonoBehavior Start() inheretance

If I have a class that inherits from a class that inherits from MonoBehavior, will both Start() functions be called when the child class is instantiated?

For example, I have a class called “CharacterController” that inherits from Monobehavior like normal. I want to use GetComponent in the Start() of CharacterController to initialize a variable by getting the component of another class type CharacterMovement if that object has one attached.

Then I want to have other classes like EnemyAIController and PlayerController, etc. that will inherit from CharacterController.

If I were to put a Start() in PlayerController, would it override the Start() in CharacterController, meaning that I would have to GetComponent in the Start() of PlayerControler and all other classes that inherit from CharacterController?

Yes, any inherited classes will cause an override of their parent class functions.
Try adding this little line in the child class’s Start function:
base.Start();

1 Like

Thanks! I wasn’t sure if Start() was ‘special’ in some way or something, and I didn’t realize you could call the base.Start() from within Start() but thinking about it now, I don’t see why not.