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
- Editor crashes and a window with "GetManagerFromContext: pointer to object of manager 'MonoManager' is NULL (table index 5)" error is shown when launching a freshly created project
- Editor Windows dragging behavior is erratic/glitchy when a specific multi-display setup is used and the Editor window is not on the main display
- Meta Quest missing an icon in Build Profiles window in U6.0
- Foldout arrow indent is misaligned in the Inspector when used for Arrays or Lists
- Material import pipeline strips properties when it is added with a script
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.