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.
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 on StoredGraphicsBuffer::GetGfxBufferID when VFX Graph property is modified during Play Mode and Application.targetFrameRate is used to limit FPS
- Crash on NVAPI_Thunk when changing Player resolution while HDR display is used and Direct3D12 is set as the graphics API
- Only one out of multiple cameras is shown in the Play Mode while HDR display is used and Direct3D12 is set as the graphics API
- The "Paste Component as New" option is incorrectly displayed as active despite the action being prohibited
- "TLS Allocator ALLOC_TEMP_TLS" errors are thrown when unsuccessfully importing an FBX file
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
fsedarkalex
Dec 14, 2019 12:04
Still happening with 2019.2.16f1. I am just uploading a bug report.