My intended pattern for my AI system was that a component OverMind would be configured on a prefab and instantiated using the prefab’s saved parameters.
So you might have one that’s set up to make sword guys and one that’s set up to make bow guys and they both have a unique model spit out different guys but all you have to do is instantiate either to set a big chain of events into motion.
One of the parameters I need is a script, it’s base class is BaseEntity. It is not abstract or anything, it’s just a regular class with some virtual methods overridden. I know for a fact scripts can be editor fields, I’ve done it before, but never with an object-oriented design.
public class OverMind : MonoBehaviour
{
public int MaxMembers;
public int FamilySize;
public BaseEntity HostedEntity;
public GameObject EntityBody;
Why doesn’t HostedEntity show up as a field in the editor? My alternative is to use an initialization method, but I don’t want to- this is the layer of my structure I wanted to be component-based.
In that scenario the OverMind script would be added as a component and in its Awake method it would disable itself, then an Initialize method you must call and pass parameters would “construct” the behavior and enable it allowing its Unity loops to start doing stuff.
Would it work if I made BaseEntity an Interface? I don’t want to, since it does have default methods (like a gravity method, for example).