BlueGraph icon indicating copy to clipboard operation
BlueGraph copied to clipboard

Json (Netwonsoft | STJ) Serialization.

Open juliolitwin opened this issue 3 years ago • 4 comments

Is your feature request related to a problem? Please describe. Bluegraph is a great library, but unfortunately it has a high dependency on Unity, as ScriptableObject and also Json's own serialization is used internally by Unity.

Describe the solution you'd like Add support for serialization to Json with Newtonsoft or STJ (don't).

Cheers!

juliolitwin avatar Sep 30 '21 21:09 juliolitwin

BlueGraph was built to leverage the same technology Unity was internally using for its own Shader Graph / VFX Graph components, so there was minimal redundant code to write. Things like undo/redo states and Unity asset referencing were supported more or less "out of the box".

Do you have a particular use case that needs JSON serialization? I could see potentially adding the ability to export/import as JSON if it helps with integrating with external applications. But I wouldn't plan on that to be the primary storage format.

McManning avatar Oct 22 '21 15:10 McManning

@McManning Hey, yes I use it for a particular case outside of Unity, it's not easy to find node libs without third-party independence. It would be welcome if you could implement json. :)

juliolitwin avatar Oct 22 '21 15:10 juliolitwin

Gotcha. The node editing UI itself is definitely Unity-dependent, since it requires Unity Editor components to work but JSON exports would certainly be doable. There would be some unknowns to deal with, specifically around handling nodes that reference Unity assets, so some effort might be required there to figure out how to support that - or how the export piece behaves if we can't support that.

Also, if you're looking for something entirely Unity independent, https://rete.js.org/ or https://flume.dev/ might be a good route to take, if you don't mind a bit of Javascript. I know rete.js has export to JSON support builtin.

McManning avatar Oct 22 '21 18:10 McManning

I was running some tests, I adapted OdinSerializer and used serialization mode in JSON. It worked correctly, passed reading tests. But OdinSerializer is necessary to adapt to work out of the box (in a way it has a certain dependency on Unity, such as Vector2~3 and other classes). The problem with OdinSerializer is that its JSON structure is a little different from the default when it comes to cycle references.

Unfortunately, I need it to be in C#, I'm not too worried about editor dependency as it will be rewritten in front - probably. Now the backend ends up being limited to C#.

juliolitwin avatar Oct 22 '21 18:10 juliolitwin