Hi,
in my project users can add entities such as cube,plane,… at run time and arrange them, how can i save entities and reload later?
JSON.stringify(entity) throw “Converting circular structure to JSON” exception.
what is the best method for save?
This codepen might give you some inspiration. It has some abstract representation of a scene graph defined in an object hierarchy at the top. Then, at line 152 in the buildModel function, that scene graph is loaded as an entity hierarchy. It would be a simple matter to write a ‘save’ function for that entity hierarchy.
Then, you can call JSON.stringify or JSON.parse on that object hierarchy and save the string to local storage or whatever.
You would need to come up with own way to serialize data you need from entities and the way to deserialize and create entities out of it.