Why scriptable object script continuously get compile error?

I made scriptable object script and SO data at unity editor.

No problem. So close unity. Shutdown computer.

But at next day, turn on unity again and open project, most SO says yellow error message and inspector referenced so all got unsynced.

Why this happen? Very annoying and hassle.

I should go to visual studio and at each class inherit scriptable object, should revise something meaningless thing like press spacekey one time at the end of some line, so that unity compile again.

After compile, some SO recovered, but not all.

Should repeat this process several time, and get reference all again. (mouse drag and drop)

How to block this script error happen?

I didn’t touched anything from code or whatever after everything is ok status and before reopen project.

8679975--1170084--so-error.JPG

What Unity version are you using?

  • Make sure that the project is not in a cloud sync directory such as Google Drive, OneDrive or others.
  • Use git for source control.
  • Project Settings > Editor > Asset Serialization Mode → Force Text
  • File > Save Project before you exit Unity
  • Don’t delete .meta files

You could dive deeper into the editor logs, see if there’s anything in there that could provide more information.

I am using newest, 2022.2.1f1

So I found reason, was I packed many SO classes into one script, so this script name is different with many SO, so SO spit out errors.

So I separate whole SO classes to each one’s own script and match script file name with that SO class name, problem solved.

2 Likes