Support for generic variables as blackboard variable

Forums 💬 NodeCanvas ⚙️ Support Support for generic variables as blackboard variable

  • This topic has 1 reply, 2 voices, and was last updated 4 months ago by Gavalakis.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #23055
    legi
    Participant

      Hey there 🙂

      I’m currently looking into potentially using NodeCanvas for my current project to ease some of the pain I have with AI behaviors.

      Is there a way to use generic types as variables and specify their underlying type? In the documentation I saw a lot about support for generic nodes as well as custom types, but nothing about this use case specifically. Unfortunately the documentation, forum search and watching a few videos didn’t answer that question for me.

      One generic struct I have is defined like this:
      <div>public struct UniqueId<T> : IEquatable<UniqueId<T>>, IComparable<UniqueId<T>> where T : struct, IIdTag</div>
      IIdTag is just a marker interface and looks likes this for example:
      <div>public readonly struct ItemTemplateTag : IIdTag { }</div>
      Through out my code I have fields like this:
      <div>UniqueId<ItemTemplateTag> _itemTemplateId;</div>
      Is NodeCanvas able to have UniqueId as a generic type inside the blackboard and there define what specific type I want (like in my example above)? Or is there any way to incorporate generic variables by defining some kind of subclass somewhere to add support for specific variants of it?

      Thank you 🙂

      #23059
      Gavalakis
      Keymaster

        Hello and sorry for the late reply. The short answer is that unfortunately generic variables like that are not supported in the front end / GUI. 🙂 Kind of irrelevant but interfaces (not generic one) are supported though, so maybe that can be a work around in your case? (Like for example using IIdTag interface).

        Thanks 🙂

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