ScriptableObject reference issue

Discussion and help for Easy Save 3
Post Reply
Keeko
Posts: 17
Joined: Sun Nov 15, 2020 9:18 pm

ScriptableObject reference issue

Post 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?
User avatar
Joel
Moodkie Staff
Posts: 4849
Joined: Wed Nov 07, 2012 10:32 pm

Re: ScriptableObject reference issue

Post 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
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
Keeko
Posts: 17
Joined: Sun Nov 15, 2020 9:18 pm

Re: ScriptableObject reference issue

Post by Keeko »

I don't create any scriptable objects at runtime, all live in the assets folder.
User avatar
Joel
Moodkie Staff
Posts: 4849
Joined: Wed Nov 07, 2012 10:32 pm

Re: ScriptableObject reference issue

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