Feature Request: Variable popups in scripts

NodeCanvas Forums General Discussion Feature Request: Variable popups in scripts

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #12191
    ReimG
    Participant

    I know I’m asking a lot, but it would be really superb if Blackboard variable could be used in custom scripts in a way I can add and edit them using inspector. I quickly created a simple implementation that works for basic types of variables, but it’d be better if I could use Variable class (or something similar) to support all types of variables.

    ncvariable_example

    Attachments:
    You must be logged in to view attached files.
    #12195
    Gavalakis
    Keymaster

    Hey,

    This is a good suggestion, but the problem to making this in a way to support all types (like BBParameter does), is actually the fact that Unity can’t serialize generics in the first place.
    So one solution to make this work, would be to allow such linked parameters (BBParameters) only in a special MonoBehaviour derived base class, that also handles the serialization and deserialization (with ISerializationCallbackReceiver), as well as proper initialization of those parameters in Awake and Validate.

    I presume that the goal here is to be able to use some kind of a special variable in the monobehaviour, that shows up in the inspector so that it can also be linked to a variable of provided blackboard?

    May I also ask how you ended implementing your version of this?

    Cheers!

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

    #12202
    ReimG
    Participant

    Yes exactly that’s what I meant.

    I needed something simple and fast for my game so I quickly created this simple classes:

    and then added editor for it:

    Maybe it’s not practical (I’m storing additional variables that aren’t needed and only take memory, and I only support only few types), but for my purposes it suffice. Maybe if I have time to implement something more sophisticated I’ll try to cram all fields into one ‘object’ field and serialize it.

    Also I love that you have ‘varType’ field. So cool 😀

    Thanks, and cheers!

    #12212
    Gavalakis
    Keymaster

    Thanks for the following up and letting me know on how you did it!
    I will dig this up a bit more and hopefully find a good solution. I can see how it can be a generally useful “feature”. 🙂

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

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