C# Inheritance and Member Hiding

I’ve been wondering about this. Let’s say I derive from a base class that inherits from MonoBehaviour and I want another class derived from this base class to contain some MonoBehaviours. IE…

(I seem to be having problems pasting code here without the formatting screwing up. Here’s a pastebin link - public class Obj_Base : MonoBehaviour{ protected void Start() { - Pastebin.com )

This works but the issue is that you’ll get this error.

Assets/Scripts/Obj_Base.cs(7,10): warning CS0108: `Obj_Derived.Start()' hides inherited member `Obj_Base.Start()'. Use the new keyword if hiding was intended

So I can use the ‘new’ keyword to get rid of this warning but is this the more elegant solution to what I want to achieve? Is there a better method/design that can be used?

It comes from the fact that you are overriding a previous method and the compiler wants you to explicitly state that. This is usually done through a virtual method:

public class BaseClass : MonoBehaviour {
      public virtual void Start () {
            Debug.Log("Base class");
      }
}
public class DerivedClass : BaseClass {
      public override void Start () {
            Debug.Log("Derived Class");
       }
}