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.
Comments (1)
-
polysoft3D
Sep 12, 2018 15:13
2018.2.3f1 not work 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
- Foldout arrow indent is misaligned in the Inspector when used in Custom Type
- [Android] The Player screen turns black when playing a video under certain conditions
- Search window icons at the bottom are cut off when Search window is resized vertically
- "Try something else?" text label is cut off when searching for a long text in the Search window
- Rendering Debugger window sections do not have a minimum width set when resizing with the slider in the middle of the window
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.