Search Issue Tracker

Fixed in 2021.1.X

Fixed in 2018.4.X, 2019.4.X, 2020.1.X, 2020.2.X



Found in



Issue ID




[SerializedField] fields produce "Field is never assigned to..." warning



1. Open the attached project (
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

  1. Response avatar


    Nov 06, 2019

    #pragma warning disable 0649
    // your code
    #pragma warning restore 0649

    Or disable it globally by adding a file named csc.rsp to the root of you Assets folder, e.g. Assets/csc.rsp, with the following contents without quotes.


    This will tell the C# compiler to not emit a warning for CS0649 / unused fields.

    If you have .asmdefs with csc.rsp in your project, then you also need to add the "/nowarn:0649" line to those csc.rsp files.

  1. Response avatar

    Resolution Note (fix version 2021.1):

    A list where you can pass additional compiler arguments as well as a toggle to suppress common warnings is added in the Player Settings
    Fixed in 2021.1.0a2

  2. Response avatar

    Resolution Note (fix version 2020.2):

    Fixed in 2020.2.0b9

  3. Response avatar

    Resolution Note (fix version 2020.1):

    Fixed in 2020.1.11f1

  4. Response avatar

    Resolution Note (fix version 2019.4):

    Fixed in 2019.4.15f1

  5. Response avatar

    Resolution Note (fix version 2018.4):

    Fixed in 2018.4.29f1

Comments (82)

  1. 759066ed26e69fa150636607cf2e9c32?d=mm


    Jul 22, 2019 02:06

    Please reopen issue

  2. F6bb6aa141dea8490a3a709c3e223adc?d=mm


    Jul 11, 2019 13:22

    This is still happening in my project (version 2019.3.0a7).

  3. 9c2381ec5cbfa0cb0c262e8a4ad4441b?d=mm


    Jun 30, 2019 17:24

    It got resolved from Rosalyn side 2 weeks ago, now it's time for Unity to implement it.

  4. 1970c0eb792cd0a79747410df4cb699e?d=mm


    Jun 28, 2019 15:36

    Still a problem in latest version (2019.3.0a4)

    [SerializeField] private bool _debug;

    "warning CS0649: Field 'SelectTool._debug' is never assigned to, and will always have its default value false"

    Please don't say this is by design, a warning should warn the user that they have done something wrong, not that they have done something completely valid but the engine can't handle it...

    and if it is by design and everything has to be public, why do we even have the [SerialiseField] attribute?

    this feels unfinished to me

  5. 783d50c318ea066fe50bde531bf259b3?d=mm


    Jun 18, 2019 03:30

    This is frustrating. I just upgraded and now I'm getting warnings all over. I want my fields private to encapsulate, and I want them serialized to expose them in the inspector. This shouldn't generate a warning.

  6. 19bcab4c25eb264b21619cd7a8a15481?d=mm


    May 30, 2019 12:31

    The most non-sense "By Design" tag I've ever seen.
    This completely makes unable to make use of CS0649 warning, and, it spams the console with hundreds of lines of warnings.

    Either disable it or fix it. A missing feature is better than a non-working and spamming one!

  7. 41b02dbd30f08d896b361aabf9fa7032?d=mm


    May 25, 2019 05:41

    There is no way this is By Design... Please reopen this issue. It's driving me nuts.

  8. C35b9264646fd1b72f6ccfca2622c409?d=mm


    May 08, 2019 15:27

    Can Unity make a video about this .Net 4.X problem?

  9. Dd8da009afba747778db5dcb5866de9e?d=mm


    Apr 26, 2019 12:49

    What makes this unnecessarily tedious is the fact that you can use "= default" for every field.

  10. 3e2ae4101faf1b19afa71b4540d5dac6?d=mm


    Apr 21, 2019 06:10

    By design, declare your private fields public.
    That makes total sense. why is anyone complaining about this?

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.