So I have an issue with a custom ActionTask that uses generic parameters in an FSM.
When I run the FSM, the parameters don’t get assigned and the parameter values end up being null.
The ActionTask:
[attachment file=”devenv_1XDpY2NDsr.png”]
The base class that makes it work with UniTask for async execution (this generally works, since all my other tasks are based on this):
[attachment file=”devenv_bjbPDapbug.png”]
The action in the FSM:
[attachment file=”Unity_OVdlLV5uR0.png”]
The blackboard:
[attachment file=”Unity_tfN8p7CTnP.png”]
It does recognize the type of T (it logs DataLoot). If I assign the parameters at runtime, it also picks up on them:
[attachment file=”Unity_Yl9JXxJlWT.png”]
However, it still does not get assigned.
Just executed with dynamic variables:
[attachment file=”devenv_uhGXoP6iEc.png”]
Assigned manually at runtime:
[attachment file=”devenv_VUupW3hIEt.png”]
I’d like to keep this generic and not make a separate function for every type that I might want to run this on. Is there a way to work around this?
Thank you everyone for rubber ducking. The solution was to add “where T : class” to the action. After plenty of reloading and regenerating AOTClasses it now works fine.
PS: Could you please add a way to automate “Generate AOTClasses.cs and link.xml Files”, since I don’t see why my input is needed to find the same paths over and over, but I have to run this like 10 times a day and it’s gotten pretty annoying.
EDIT: Oh, and yeah, obviously with the change above I’m sacrificing being able to use value types, but this is good enough for me. If someone has a solution that will also work for value types, that would be interesting.