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
- Crash on ResizeScriptingList<ScriptingObjectPtr> when passing an undeclared variable to the results parameter for GameObject.FindGameObjectsWithTag
- [Android] "Screen.safeArea.y" always returns values outside of the Safe Area when the device is in Portrait orientation
- Frame spike due to many TreeRenderer.TreeUpdated calls when repositioning terrains in large Scenes
- Crash on GameObject::RemoveComponentFromGameObjectInternal when reparenting Text GameObjects
- [IL2CPP-GarbageCollector] Changing GCMode might permanently disable GC in a multithreaded context
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.