Types for generic actions are currently constrained to be UnityEngine.Objects. It would be very useful to target Components on the GameObject which implement an interface instead. Would this be possible to implement since GetComponent<> has supported interfaces for quite some time? Thanks
Targeting interfaces is already possible, but as of now, it is done with a workaround and by using the special [AgentType] attribute. With that said, to support interfaces in the generic actions, all you have to do is please open up ActionTask.cs and change line #14..
From This:
Hi, thanks very much for the reply. Apologies for the delay I was on vacation. My coworker tested this and wanted to relay two problems he found:
1. Implementations of an interface which do not subclass components break the GUI in the inspector and blackboard view in the Canvas screen. Attempts to interpret them as Components when they should be rendered with the object view instead
2. Agents not subclassing components, when assigned with a dynamic variable, have their references lost at start. Says that the agent is null or not set. The dynamic identifier is definitely set correctly at editor time, and the object is populated in the blackboard at runtime.
I hope you had a great time on your vacation 🙂
The whole system is built around agents being a Component subclass type, so even though with this change you can use an interface for “Agent Type”, the concrete type must still derive from Component. Is your use case to use non-component derived agents from say Blackboard Variables?