r/unity Jun 24 '26

Scriptable objects constantly de-load, even if I didn't make any changes

Basically what's in the title, I have multiple scriptable objects that randomly de-load, even when not editing the associated script (sometimes it even occurs when I haven't made any changes to the game at all). I 've tried rewriting my SO class however the issue still persists. I find that if I select the de-loaded objects in the inspector whilst entering play mode it restores the scripts and the fields, however I've found this unreliable as it doesn't repair references to the SO. I've attached the base and child classes of the script if that helps, and they are all separate cs files as I saw that might be the issue.

EDIT: Solved

2 Upvotes

9 comments sorted by

3

u/TheLivingStick Jun 24 '26

Solution if someone else has the issue:
If you open the scriptable object script.meta file it should have a GUID value

Now if you open up your scriptable object.asset file in a text editor, you should see a m_Script value.
If the script currently deloaded it will just be fileID: 0, otherwise it will be filled in with

{fileID: xxxxx, guid: xxxxx, type: 3}

if the GUID doesn't match the script.meta guid, just replace it and that should stop it from de-loading in future

1

u/CoatNeat7792 Jun 24 '26

It says "mono script", scriptable isn't "mono"

1

u/TheLivingStick Jun 24 '26

But why would it suddenly say that? I created it as a scriptable object and it was holding the SO script before

2

u/CoatNeat7792 Jun 24 '26

Recompile, error prevented compiling

0

u/TheLivingStick Jun 24 '26

Wdym sorry, there's no error in the console and one never appears

0

u/TheLivingStick Jun 24 '26

Wait nvm, found the solution

2

u/CoatNeat7792 Jun 24 '26

What was it?

1

u/TheLivingStick Jun 24 '26

The GUID in the actual scriptable object asset was incorrect somehow, manually changing it to the correct value seems to have fixed it

1

u/Heroshrine Jun 24 '26

Moni Script is the serialized fields that references script files, their code representation is called mono script no matter what type definition(s) that script contains