Forums › 💬 NodeCanvas › ⚙️ Support › New Unity dictionary serialization. › Reply To: New Unity dictionary serialization.
Hi,
There is something wrong going on with this attribute in the BlackboardSource class.
|
1 2 |
[ParadoxNotion.Serialization.FullSerializer.fsSerializeAs] private Dictionary<string, Variable> _variables = new Dictionary<string, Variable>(StringComparer.Ordinal); |
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
|
1 2 3 4 |
NullReferenceException: Object reference not set to an instance of an object NodeCanvas.Framework.Blackboard.SelfSerialize () (at Assets/Plugins/ParadoxNotion/CanvasCore/Framework/Runtime/Variables/Blackboard.cs:57) NodeCanvas.Framework.Blackboard.UnityEngine.ISerializationCallbackReceiver.OnBeforeSerialize () (at Assets/Plugins/ParadoxNotion/CanvasCore/Framework/Runtime/Variables/Blackboard.cs:36) UnityEditor.GUIView:ProcessEvent(EntityId, IntPtr, Boolean&) |
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.
