Hi, I can’t find any posts about this problem, so…
Here’s the setup…
We make gameplay prefabs that use Node/FlowCanvas
These prefabs are re-used multiple times on multiple levels
A simple example from Mario would be the ? block – an object with some functionality that is used all over the game
These have blackboards (obviously) with several variables
Many of these variables are designed to be overridden, so that the prefab instances in the level can do something different to the defaults set on the base prefab
Using the Mario example again, the first ? block in the level might spawn a coin, the next one in the level might spawn a mushroom – so the ObjectToSpawn variable would be overridden
As a result, we have a large number of prefab instances that have blackboards with overridden variables
So far, so good. However…
If we change the order of the variables on the base prefab, the blackboard on any prefab instance that also has overridden variables get messed up – variables are changed or disappear entirely
The result is that we must manually fix up each broken prefab instance, which is very time consuming as they are used all over the place and makes it a real risk to make any changes to the base prefab after it has been used on levels
We really need blackboards to be 100% rock solid – able to deal with adding, removing, moving and renaming variables without causing all prefab instances to break.
Is this a bug, or expected behaviour, or is there something that I have missed?
We totally disabled the possibility to have Variant on prefab with blackboard, it was much more difficult to fix blackboard than applying change on variant.
As a result, level designer use special scripts to override blackboard value in their level, which is a weird hot fix.
Indeed, re-ordering the variables of prefab assets when some of the variables in the prefab instance are overridden, can mess up the variables in the prefab instance. This is specifically true when the re-ordered variable “pass over” an overridden variable. In the new version (just released), I have unfortunately disabled re-ordering in prefabs to avoid accidents, but meanwhile I do also look into refactoring the whole serialization of blackboard variables once again, in hopes to handle this better. I do have an idea that I think will work but it needs some time to work on it. As such, the disabled re-ordering for prefabs is a temporary measure until I’ve tested and implement that new way of handling variables.
Hi! I’m new to NodeCanvas, and really enjoying it.
I’m using an increasingly large number of Blackboard Variables on a Prefab (not Graph Variables), and am wondering if you ended up adding a way to enable reordering of them? Perhaps only when editing in the prefab itself (not an instance)? I can see how this is tricky to implement. Just curious if you added functionality that I’m missing.
Hello and welcome! I’m glad you enjoy NodeCanvas! 🙂
Even though there was a lot of refactoring and updates since back then, the last time I tried implementing this, it was unfortunately still a pain as to keep it safe in the frontend :-/ I will give this another look however!
Thanks!