Search Issue Tracker
Fixed in 2017.3.0f3
Fixed in 2017.2.X
[.NET] const field named same as a field in base class causes the field in base class to not get serialized
Repro consists of 2 classes:
abstract class BaseClass : MonoBehaviour
private int m_Number = 5;
public void LogNumber()
class DerivedClass : BaseClass
private const int m_Number = 56;
private void Awake()
Drag DerivedClass onto main camera, and set "m_Number" field to 22 in the inspector. Hit play in the editor and observe the following output:
Now, build to Windows Store .NET scripting backend. Run it, and observe this output:
A script behaviour (probably DerivedClass?) has a different serialization layout when loading. (Read 32 bytes but expected 36 bytes)
Did you #ifdef UNITY_EDITOR a section of your serialized properties in any of your scripts?
(Filename: D:\Projects\unity\Runtime/Serialize/SerializedFile.cpp Line: 1895)
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
- [iOS] Back Triple Camera is not focusing manually and automatically
- Mouse inputs cannot be inputted when searching the Shortcuts Menu by type "Shortcut"
- "Debug Assertion Failed!" error when launching Windows Dedicated Server Player with Script Debugging enabled
- [Cinematic Studio][3D HDRP] Shader warnings thrown in the Console window when creating a new project with Cinematic Studio template
- Autoplay is triggered on Audio Assets when changing Asset Bundle tags