Page 1 of 1

Scriptable Objects created at runtime

Posted: Sun Nov 28, 2021 6:12 pm
by Goose
Hi there - Not sure what I'm doing wrong - my GameObject loads and saves just fine, except I have a List of ScriptableObjects created at runtime, and when I save and later load, the size of the List is accurate, but each of the elements are null:
(At the save point)
ES31.jpg
ES31.jpg (47.64 KiB) Viewed 528 times
(At the load point)
ES32.jpg
ES32.jpg (58.01 KiB) Viewed 528 times
Many thanks for any help you can provide!

Goose

Re: Scriptable Objects created at runtime

Posted: Mon Nov 29, 2021 9:14 am
by Joel
Hi there,

This is because the ScriptableObjects will be saved by reference, not by value, meaning a reference to them will not exist. You need to save them separate with a separate ES3.Save and Load call to ensure they are saved by value.

All the best,
Joel