I created a level saving system where all the items in the level gets saved turned into a json string just using a for loop.
I have just had some problem in figuring out how to properly and easily load an item, where every item have a different script inside it and it should save different values (ex: one item have a script called “hello there” where “id” value should be loaded and another have a script called “general kenobi” where “general grievous” value should be loaded). Should i just have a long switch statement witch each obj_id inside it and do a different action from each? or is there a more proper way to do it?
if youre wondering this is the JSON i get for each item: {“name”:“Box (1)”,“position”:{“x”:2.0,“y”:6.5,“z”:3.0},“rotation”:{“x”:0.0,“y”:0.0,“z”:0.0},“scale”:{“x”:1.0,“y”:1.0,“z”:1.0},“color”:{“r”:0.0,“g”:0.8793842792510986,“b”:1.0,“a”:1.0},“obj_id”:3,“id”:“”,“_static”:true}