Can't add properties to StatementNode

NodeCanvas Forums Support Can't add properties to StatementNode

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #13383
    keenanwoodall
    Participant

    I’m working on a dialogue system and wanted more control from the Statement Node.
    I added the options for statements to be additive, wait for input, and have an end delay.
    All of these changes are in the original Statement.cs and StatementNode.cs file. I updated the inspector and the fields are serialized, but whenever I change the custom values in the node editor, it isn’t reflected in the statement data sent through the dialogue events.

    I have the values sent through the event printed the moment they’re received and they are always set to their default values.
    Debugging
    Inconsistency

    Statement.cs
    Here’s the modified interface.

    And the modified class implementation

    StatementNode.cs

    #13387
    keenanwoodall
    Participant

    Ok, I finally figured it out. The statement is sent through the BlackboardReplace method, which returns a new Statement. It uses a constructor that (obviously) has no idea of the custom properties I’ve added so the values are set to their defaults.

    #13402
    Gavalakis
    Keymaster

    Hey,

    You figured it out before my reply, but indeed, this is exactly what was happening 🙂
    With that said, I’ve just changed BlackboardReplace to be more convenient by making a serialized copy instead of using a constructor to return a new statement, so that it is more convenient (and probably more correct), thus avoid mandatory adding your properties to the constructor.

    – Add this on the first line of BlackboardReplace method:

    Return this by the end instead of the constructor:

    If you have any further problems, please let me know.
    Thanks!

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

    #13412
    keenanwoodall
    Participant

    Thanks for the reply and alternative to constantly updating the constructor.

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