- Home /
Question by
OnlineGames · Jun 17, 2021 at 01:46 PM ·
inheritancemonobehaviour
How to serialize fields for both base and derived classes?
The question is how to see both fields in editor?
public abstract class A : MonoBehaviour
{
[SerializeField] protected float fieldA; // NOT VISIBLE IN EDITOR
}
public class B : A
{
[SerializeField] protected float fieldB;
}
Comment
At least I don't see any problem in the code. B should have the fieldA and fieldB visible just fine in the inspector. Just check that file and filenames are ok and saved etc..
Thank you, seems that was a bug. Works fine for me now.
Your answer
Follow this Question
Related Questions
Is it possible to create game object/prefab from file? 2 Answers
MonoBehaviour inheritance problem 1 Answer
What is the signature of Awake() and Start() 1 Answer
C# Conception - Hide inherited members and functions 1 Answer
[C#] Using Static Create() methods with inheritance and Monobehaviours? 3 Answers