Scriptable Objects created at runtime

Discussion and help for Easy Save 3
Post Reply
Goose
Posts: 1
Joined: Sun Nov 28, 2021 6:10 pm

Scriptable Objects created at runtime

Post 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 485 times
(At the load point)
ES32.jpg
ES32.jpg (58.01 KiB) Viewed 485 times
Many thanks for any help you can provide!

Goose
User avatar
Joel
Moodkie Staff
Posts: 4826
Joined: Wed Nov 07, 2012 10:32 pm

Re: Scriptable Objects created at runtime

Post 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
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
Post Reply