Search Issue Tracker
Fixed in 2017.1.0f3
Votes
0
Found in
2017.1.0b1
Issue ID
902037
Regression
Yes
Project sometimes fail to build due to different serialization order in Editor and Player
Reproduction steps:
1. Open project attached (PartialClassBuild.zip).
2. Build it on standalone player.
Expected result: It will be built successfully.
Actual result: Building stops, output from console: (NOT ALWAYS!)
Error: "Type '[Assembly-CSharp]Player' has an extra field 'FieldTwo' of type 'System.Int32' in the player and thus can't be serialized (expected 'FieldOne' of type 'System.Int32')"
Error: Type '[Assembly-CSharp]Player' has an extra field 'FieldThree' of type 'System.Int32' in the player and thus can't be serialized (expected 'FieldOne' of type 'System.Int32')
Error: "Fields serialized in Editor, class 'Player'
'FieldOne' of type 'System.Int32'
'FieldTwo' of type 'System.Int32'
'FieldThree' of type 'System.Int32'"
Error: "Fields serialized in target platform, class 'Player'
'FieldTwo' of type 'System.Int32'
'FieldThree' of type 'System.Int32'
'FieldOne' of type 'System.Int32"
Error: "Error building player because script class layout is incompatible between the editor and the player."
Note: This does not appear all the time. If it is not reproducible from first time, just makes some changes (add space) in Player.cs.
Reproduced on: 2017.1.0a3, 2017.1.0b1.
Works fine on: 5.6.0p1.
Regression introduced in 2017.
Comments (22)
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
- [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
- Last segment of a Sprite Shape Spline is affected by other segments' Sprite Variant change when no edge Sprite is selected
Saeed-Barari
Jan 30, 2025 18:28
happened in 2022.3 LTS (not the latest build version), fixed it by building once through the built-in build window. it wouldn't build with a custom builder script i had written, even if i had specified the clean cache option.
skoteskote
Sep 23, 2022 10:00
Just got this issue on 2021.3.10f1, reloading script assemblies resolved it.
lolerji
Apr 17, 2022 10:53
Still happens on 2020.3.30f1. This is not resolved.
ShahAhmed1
Nov 22, 2021 09:35
Simply
Delete those scripts and restore from recycle bin
JanBaaootbg
May 20, 2021 09:25
I just had the same error with referring to UnityEngine.UI.InputField with v.2021.1.7.f1.
The only thing that worked for me was:
- uninstall all unity versions
- uninstall unity hub
- delete temp and appdata unity files
- remove unity keys from registry under Computer\HKEY_CURRENT_USER\SOFTWARE
After reinstalling the errors are gone …
Ghosthowl
Mar 24, 2021 09:43
Just had the same error in 2020.3.0f1.
Trungdv
Jan 30, 2021 01:46
The error also appears in Unity 2019.4.16f1
LMMWidowGames
Jun 18, 2020 19:20
Hi,
This issue happened to me with an abstract class that inherits from Monobehaviour. I think the issue appears when the abstract class has public fields that, in theory, can be serialized by Monobehaviour. If another class inherits from this abstract class and is added as component, the editor will work fine but crashes when building.
As a workaround I tagged the fields of the abstract class as [HideInInspector] and I have been able to build fine.
Hope this workaround helps you.
AlejandroBA7
Feb 08, 2020 00:44
The error also appears in Unity 2019.3.0f6
sandeepkiks
Jan 17, 2020 08:59
This issue again happens in Unity 2019.3.0f5