New Unity dictionary serialization.

Forums 💬 NodeCanvas ⚙️ Support New Unity dictionary serialization.

  • This topic has 6 replies, 3 voices, and was last updated 1 week, 1 day ago by erdoal.
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #23195
    jnog
    Participant

      Hi @Gavalakis

      The current implementation of NodeCanvas’s blackboard serialization seems to conflict with Unity’s upcoming dictionary serialization, which will ship with 6.6.

      I understand Unity 6.6 is still in Beta and not are not supporting it yet, just wondering if this is on your radar and if you have an idea of how much effort it will be to support it (i.e. minor changes vs significant refactor of NodeCanvas’s serialization code).

      Thanks!

      #23200
      Gavalakis
      Keymaster

        Hello!

        Thank you for letting me know! I wasn’t aware of it actually and don’t know what the conflict is right now, but I will of course take a look it ASAP after summer vacation. Hopefully it will not be something major!

        Thanks!

        #23203
        jnog
        Participant

          Hey, I went over the NodeCanvas code and realized it’s actually doing fully custom serialization for blackboards and graphs, so this shouldn’t be an issue at all. Supressing the compiler error with pragmas should suffice.

          On .\ParadoxNotion\CanvasCore\Framework\Runtime\Variables\Internal\BlackboardSource.cs, line 13:

          It was already disabling UAC1009 anyway (even though that was just a warning, not an actual error).

          #23204
          Gavalakis
          Keymaster

            Hey, thanks for letting me know! Yes, NodeCanvas uses custom serialization 🙂

            #23211
            erdoal
            Participant

              Hi,

              There is something wrong going on with this attribute in the BlackboardSource class.

              From what I checked when updating my old NC version to work with Unity 6.6, it used to be [SerializeField] there, but as far as I understand, this attribute did nothing at all, as Dictionary serialization wasn’t supported. Now in 6.6 (6000.6.0f1) they made [SerializeField] explicitly show up as an error.

              So after updating to 3.42, I have this problem when [ParadoxNotion.Serialization.FullSerializer.fsSerializeAs] is present. When I open a prefab that has FSM Owner and Blackboard components, the blackboard doesn’t load properly and my console is spammed with

              Pointing to this line:

              if ( newSerialization != _serializedBlackboard || !newReferences.SequenceEqual(_objectReferences) || ( _serializedVariables == null || _serializedVariables.Length != _blackboard.variables.Count ) )

              From my understanding, _blackboard.variables here is null.

              Interestingly, if I remove this attribute entirely, this prefab works perfectly. However, another problem happens instead. Now without this attribute, other objects, even prefab instances, where I have FSM Owner components that don’t have a blackboard attached as a component, only the blackboard inside the graph, can’t load their blackboard variables.

              (Execution Error): A Parameter Variable named 'cooldown' is missing. If it was meant to be a dynamic variable, please ensure that it starts with an underscore ('_') prefix by convention.

              #23212
              Gavalakis
              Keymaster

                Hello,

                Just to clarify, [SerializeField] did something; it was serializing the blackboard, but through FullSerializer (which is the custom serializer used in NodeCanvas). The change to [fsSerializeAs] has practically no difference at all, because both [SerializeField] and [fsSerializeAs] do exactly the same thing as far as FullSerialize handles them.

                Do no remove the attribute. It is required to serialize the blackboard.

                I have tried opening old projects and everything works as expected (there is honestly no reason not to since both attributes do the exact same thing Full Serializer wise). Could it be that your get the errors because you removed the attribute first and then re-added?

                Let me know. Thanks.

                #23215
                erdoal
                Participant

                  Hey, thanks for the clarification! Restarting and re-importing a few times seems to have solved it.

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