Hi,
If the variable to save (e.g., point_1) is a reference to a GameObject, Transform, or the like, Unity JsonUtility can't serialize it into a text string. The save system's JsonDataSerializer component uses JsonUtility.
Instead, if you can give point_1's GameObject a unique name, you can save the name. In ApplyData(), you can find the GameObject again by its name.
Alternatively, you could save some other info that uniquely identifies that GameObject so you can find it later when restoring the saved game. This is a little more complex, so if you can use unique GameObject names it will be simpler to code up.
Save spawned object prefab and it's position
Re: Save spawned object prefab and it's position
Changing the name just seems to erase it when I try to save. Each new Instantiated object just labels it as "name"(Clone). I guess unity stopped doing clone numbers or something. I guess the system dose not keep track of name changes by default then.
Re: Save spawned object prefab and it's position
Hi,
You may need to set the Save System's Frames To Wait Before Apply Data to 1 if you haven't already. Here's an example scene:
StickyNoteExample_2024-02-20.unitypackage
See the "---README---" GameObject for notes on the scene as well as the comments in the scripts.
You may need to set the Save System's Frames To Wait Before Apply Data to 1 if you haven't already. Here's an example scene:
StickyNoteExample_2024-02-20.unitypackage
See the "---README---" GameObject for notes on the scene as well as the comments in the scripts.
Re: Save spawned object prefab and it's position
Amazing. Thank you for going above and beyond man.
Re: Save spawned object prefab and it's position
Happy to help! If you have questions about it, let me know.