Search Issue Tracker
Not Reproducible
Votes
10
Found in
5.6.1f1
Issue ID
922226
Regression
No
Serialized Scriptable Object works in the Editor, but not in the Build
To reproduce:
1. Open the "Game" scene in the attached project
2. Play the scene
3. Press any key
4. Click on the blue squares on the "Sector A1" area to observe the desired navigation
5. Build and Run the scene
Desired outcome: Navigation (step 4) on the Build produces the same behaviour as in the Editor
Actual result: The "Sector A1" area shows no image, pressing blue squares for navigation results in "NullReferenceException"
Note: When running the Build, the following console message appears:
"A script behaviour (script unknown or not yet loaded) has a different serialization layout when loading. (Read 48 bytes but expected 88 bytes)
Did you #ifdef UNITY_EDITOR a section of your serialized properties in any of your scripts?"
Reproduced with 5.6.1f1, 5.6.2f1, 2017.1.0a1, 2017.1.0f1, 2017.2.0b1
Could not test on 5.4, 5.5 due to console errors
Note: On 2017.2.0b1 due to scripts and assemblies that use obsolete APIs, some Game Objects are not visible, but the message about "different serialization layout when loading" is still reproducible in the Build.
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- UI Overlay Image gets darker on each Camera when multiple Cameras are used
- Assertion failed on expression: 'scriptedImporterClass == SCRIPTING_NULL error when opening the standalone profiler window
- Disabled assets in Import Unity Package window aren't tracked but count as being selected by user
- [Windows] Crash on GetManagerFromContext when video is playing and creating High Definition 3D Projects after FMOD failed to switch back to normal output Error appeared
- GC Alloc produced when adding items to MultiColumnListView with Auto Assign Binding
Resolution Note:
The problem here is that the ScriptableObject asset was created using a class inside a file that didn't match the class name. This is a rule in Unity, because of how assets are referencing their MonoScript asset.
In order to circumvent this, an error dialog will pop up when trying to assign a ScriptableObject asset that has been created from a mismatching file.