I created custom generic action/conditional tasks and add constraints for the designer’s convenience. In my case where T : Enum. Unfurtnelty AOT generator omits it and all fail on il2cpp build. If it’s possible it would be great to have such a feature.
I want to make sure someone won`t use the wrong generic type on the GUI graph anyway, so what is the best approach to handle this and avoid runtime errors?
//Edit: I found in the docs
The types shown will be constrained in case T has a constraint
Did I miss something? I work on Unity 2020.2.1 and NC 3.1.6.
Indeed. Enum constraints are not taken into account. I have just fixed this however and have attached for you here the updated file 🙂
Let me know if this works for you and thanks for bringing this into my attention!
it works, thanks! But still fails with any other constraint than enum.
E.g. public class TestAction<T> : ActionTask where T : MyAbstractClass public class TestAction<T> : ActionTask where T : IMyInterface
I added these types to the list.
So the issue is a bit more complex here. If so, an appropriate notice in the Generic tasks\AOTdocs section can be helpful. If it’s hard or impossible to generate such dummies it would be nice to have errors/warnings on AOT created also.
Dont worry about the wrong section. Your examples should work, since only value types (in context of generics) are required to be generated for AOT to work. Can you please post the error logs you get?