Question by
isaacspiegel · Jan 20, 2020 at 05:00 PM ·
scripting beginnerinheritanceclasses
Reference mono script by parent class for ducktyping
I have a game object defined like so:
[ExecuteInEditMode]
public class Agent : MonoBehaviour
{
public Guidance activeGuidance;
public Control activeControl;
...
}
I'd like to be able to drop any script into the inspector that inherits from Guidance or Control. How can I specify the parent type but leave the actual subclass ambiguous?
Comment
I'd like to be able to drop any script into the inspector that inherits from Guidance or Control
This should be possible with your current script.
Your answer
Follow this Question
Related Questions
Class Inheritance Issue. 0 Answers
C# - creating a list of classes 5 Answers
Help with object oriented 0 Answers
Inheritance and Update Method 1 Answer
Using a subclass in the inspector in place of a parent class and accessing the subclass variables 1 Answer