Page 1 of 1

ScriptableObject reference issue

Posted: Fri Oct 13, 2023 10:47 pm
by Keeko
the format of my project is: Main Menu Scene > TownView scene > Any Level

After levels are complete, they go back to the townview scene, the townview has references to all of my scriptable objects and prefabs, they are carried across to the level in inventory objects if the player chooses to buy them. Upon saving them in the townview scene, i can see the file contains references to the scriptable objects. However if the player fails that level and restarts it, it fails to load the reference to the scriptable object correctly.

I noticed that all the saving and loading works correctly, if i set EasySave manager to dontdestroyonload from the main menu, but ideally i'd like to be able to run any scene straight from the editor and not have the saving and loading break.

I have an easy save manager in every scene, i've tried rightclicking all of these assets and adding references to them, ive tried doing this in multiple scenes too. Any ideas on what i'm doing wrong here?

Re: ScriptableObject reference issue

Posted: Sat Oct 14, 2023 9:29 am
by Joel
Hi there,

It sounds like your ScriptableObjects are being assigned a new reference ID at runtime. Are your ScriptableObjects created at runtime, or are they a ScriptableObject in the Assets folder which exists prior to runtime?

All the best,
Joel

Re: ScriptableObject reference issue

Posted: Sat Oct 14, 2023 5:07 pm
by Keeko
I don't create any scriptable objects at runtime, all live in the assets folder.

Re: ScriptableObject reference issue

Posted: Sun Oct 15, 2023 9:57 am
by Joel
Have you been adding the ScriptableObjects to the reference managers of all of the scenes, not just the Main Menu? From what you've described it sounds like the references are only in the manager of the main menu scene.