if I create class A : MonoBehaviour and class B : A, I cannot attach B to a GameObject in 2020.2b2. B does not appear in the list when clicking Add Component, and drag/dropping the script onto a GameObject shows “The script don’t inherit a native class that can manage a script.”
This approach works completely fine in 2020.1.5f1 and earlier versions. I also upgraded an existing project that makes use of MonoBehaviour inheritance, and the behavior in my game is now very buggy. If A has virtual void Start() and B has an override that calls base.Start(), then component B will start receiving Update()s as soon as base.Start() completes (but before B’s Start() does), which breaks all kinds of things.
using UnityEngine;
public class A : MonoBehaviour
{
public virtual void Start()
{
Debug.Log("A::Start", this);
}
}
B.cs:
using UnityEngine;
public class B : A
{
public override void Start()
{
base.Start();
Debug.Log("B::Start", this);
}
void Update()
{
Debug.Log("B::Update", this);
}
}
The test case posted above is almost identical to what I was using, and also didn’t work for me. However after a reboot the problem is gone and both test cases as well as my original project are working as expected again.