I'm developing a 2D space-shooter in Unity game engine.
I have a base class containing the variables shared among all the enemy space ships and that base class contains functions that are meant to be called by every instance of the derived classes. Take this void Start() function for example:
Base Class
public class EnemyBaseScript : MonoBehaviour { // some public/protected variables here protected void Start () { // some initializations shared among all derived classes } . . . } Derived Class
public class L1EnemyScript : EnemyBaseScript { // Use this for initialization void Start () { base.Start (); // common member initializations hp = 8; // hp initialized only for this type of enemy speed = -0.02f; // so does speed variable } } I think you get the idea. I want the common initalizations to be done in the base.Start() function and for the class-specific initalizations to be done in this Start() function. However, I get the warning:
Assets/Scripts/L1EnemyScript.cs(7,14): warning CS0108:
L1EnemyScript.Start()hides inherited memberEnemyBaseScript.Start(). Use the new keyword if hiding was intended
I lack experience in OOP and C#, so what is the correct way to do what I think? What does this warning mean and how can I do it right?