Forums › 💬 NodeCanvas › 🗨️ General Discussion › Feature Request: Save to JSON by default › Reply To: Feature Request: Save to JSON by default
Pre-TLDR: Unity’s forced-text serialization YAML is really bad, and breaks imported assets without even telling you. If possible, an option for JSON saving by default (if it’s still select-able as an asset within Unity, such as it is now), or, an option to save a .json file alongside the .asset file, is still on my wish-list for NodeCanvas
I know (from what I read), as a user we can’t selected a specific serialization format for specific asset files, is that possible in code for you to easily switch the asset files to use YAML? Or does it -have- to be Unity’s global setting?
The reason I ask is because while converting my entire project to YAML works alright (aside from unsigned integer errors from Unity 5+), importing third party assets can break (from what I read, and…)
I verified this twice, because the very next package I imported wasn’t working properly, even though no errors are thrown, and I only knew it was an import problem because I had just read about the issue and reverted to a previous git commit to test,
The workaround, I read from the internet, is to switch your project to ‘Mixed Serialization’, import the third party asset, then switch BACK to “Forced Text Serialization”, which all-in-all, is time consuming and a huge pain to be honest.
My real push for having NodeCanvas things saved in a somewhat text readable format for A) git, B) comparing and retaining information, is because NodeCanvas is in effect replacing what we would be writing in code, and your JSON export is really readable. Let me know what you think!
Plus, comparison of NodeCanvas JSON vs Unity’s YAML:
NodeCanvas:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
{ "version": 2.20000004768372, "type": "NodeCanvas.StateMachines.FSM", "name": "Basic Enemy", "comments": "", "translation": { "x": -7911.9990234375, "y": -8005.9990234375 }, "nodes": [ { "_actionList": { "executionMode": "ActionsRunInParallel", "actions": [ { "searchTag": "Player", "saveAs": { "_value": null, "_name": "Player" }, "_isActive": true, "overrideAgent": null, "$type": "NodeCanvas.Tasks.Actions.FindWithTag" |
vs Unity…
|
1 2 3 |
_serializedGraph: '{"version":2.20000004768372,"type":"NodeCanvas.StateMachines.FSM","name":"Basic Enemy","comments":"","translation":{"x":-7911.9990234375,"y":-8005.9990234375},"nodes":[{"_actionList":{"executionMode":"ActionsRunInParallel","actions":[{"searchTag":"Player","saveAs":{"_value":null,"_name":"Player"},"_isActive":true,"overrideAgent":null,"$type":"NodeCanvas.Tasks.Actions.FindWithTag"}],"_isActive":true,"overrideAgent":null},"_repeatStateActions":false,"_transitionEvaluation":"CheckAfterStateFinished","_collapsed":false,"_position":{"x":8220.0,"y":8130.0},"_name":"Initialize","_tag":null,"_comment":null,"_isBreakpoint":false,"$type":"NodeCanvas.StateMachines.ActionState","$id":"2"},{"_nestedBT":{"_value":null,"_name":"PatrollingBehaviour"},"executionMode":"RunForever","updateInterval":0.0,"successEvent":null,"failureEvent":null,"_transitionEvaluation":"CheckContinuously","_collapsed":false,"_position":{"x":8535.0,"y":8220.0},"_name":"Patrolling","_tag":null,"_comment":null,"_isBreakpoint":false,"$type":"NodeCanvas.StateMachines.NestedBTState","$id":"7"},{"_actionList":{"executionMode":"ActionsRunInSequence","actions":[{"functionWrapper":{"_targetMethod":{"_baseInfo":"Enemy2DController|StopMoving","_paramsInfo":""},"$type":"NodeCanvas.Framework.Internal.ReflectedAction"},"_isActive":true,"overrideAgent":null,"$type":"NodeCanvas.Tasks.Actions.ExecuteFunction"},{"functionWrapper":{"_targetMethod":{"_baseInfo":"Enemy|Jump","_paramsInfo":""},"$type":"NodeCanvas.Framework.Internal.ReflectedAction"},"_isActive":true,"overrideAgent":null,"$type":"NodeCanvas.Tasks.Actions.ExecuteFunction"},{"waitTime":{"_value":0.5,"_name":null},"finishStatus":"Success","_isActive":true,"overrideAgent":null,"$type":"NodeCanvas.Tasks.Actions.Wait"}],"_isActive":true,"overrideAgent":null,"$id":"10"},"_repeatStateActions":false,"_transitionEvaluation":"CheckContinuously","_collapsed":false,"_position":{"x":8610.0,"y":8370.0},"_name":"Saw Player","_tag":null,"_comment":null,"_isB |
(Which you can paste into a JSON beautifier, but it’s still far, far less readable than NodeCanvas’ export I think)
