Search Issue Tracker
[SerializedField] fields produce "Field is never assigned to..." warning
1. Open the attached project (warning.zip)
2. Observe the warning in the console
Expected: field with SerializeField attribute do not produce the warning
Reproduced in 2018.3.0a1, 2018.3.0b1, 2018.3.0b2, 2019.1.0a1
Did not reproduce in 2018.2.8f1
Regression introduced in 2018.3.0a1
The new C# compiler is correct in reporting the additional warnings. Unfortunately, there is no magic to fix this.
You can disable the warnings with pragmas:
#pragma warning disable 0649
// your code
#pragma warning restore 0649
Or disable it globally by adding a csc.rsp file to your project and adding command line switch to disable the warning.
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
- [iOS] Apple throws Deprecated API Usage warning for using UIWebView in Unity Ads when submitting Builds to the App Store Connect
- Canvas' and Camera's gizmos resize when Scene View is maximized
- Animator.Update CPU time spikes when multiple animations are playing
- Assert Exceptions in Finalizers are not logged to Console
- Unable to hide GameObject's private/internal methods during selection of a function for Animation Event