Constraints generic tasks

NodeCanvas Forums Custom Nodes & Tasks Constraints generic tasks

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #15476
    cywil
    Participant

    Hi,
    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.

    #15480
    Gavalakis
    Keymaster

    Hello,

    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!

    Join us on Discord: https://discord.gg/97q2Rjh

    Attachments:
    You must be logged in to view attached files.
    #15483
    cywil
    Participant

    Hi,
    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.

    #15484
    cywil
    Participant

    Oh and so sorry about the wrong section! Please move my post to issues. Thanks!

    #15493
    Gavalakis
    Keymaster

    Hello again,
    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?
    Thank you.

    Join us on Discord: https://discord.gg/97q2Rjh

    #15499
    cywil
    Participant

    Hi!
    Yes, you are absolutely right.
    Edit: I double-checked and looks like an issue on my side.
    Thanks a lot for your help!

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.