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. lukaszunity

    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. 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. Resolution Note (fix version 2020.2):

    Fixed in 2020.2.0b9

  3. Resolution Note (fix version 2020.1):

    Fixed in 2020.1.11f1

  4. Resolution Note (fix version 2019.4):

    Fixed in 2019.4.15f1

  5. Resolution Note (fix version 2018.4):

    Fixed in 2018.4.29f1

Comments (82)

  1. Bip901

    Sep 23, 2020 15:37

    Solution: explicitly assign the default value to the field. E.g:

    [SerializeField] private Collider myCol;


    [SerializeField] private Collider myCol = default;

  2. Sliem001

    Sep 09, 2020 08:03

    Unity 2020.20b1 Beta
    Problem still exists.

    Please FIX!!!

  3. miniwolf_unity

    Sep 01, 2020 11:36

    We are investigating how to solve this. I would encourage you to add your thoughts and opinions to this thread:

  4. darthdeus

    Aug 24, 2020 18:39

    Please fix this :( I wonder if there's some reason why this is difficult, or if Unity just prioritizes adding more features over fixing minor annoyances. I'd imagine since the compiler can see the actual attribute [SerializeField] it shouldn't be hard, but maybe I'm missing something.

  5. Johannes_R

    Aug 10, 2020 21:18

    Unity gives me warning for not initializing my struct member variables. :(
    (Unity 2019.4)

  6. VGMFR

    Aug 07, 2020 09:00

    Each new release since a year and a half I'm checking the whole changelog praying that this issue has moved from "Known Issues" to "Release Notes". One day, maybe...

  7. kyuskoj

    Aug 03, 2020 03:49

    Someday ...

  8. antonsem

    Jul 29, 2020 12:59

    It is possible to suppress these warnings with csc.rsp file. But it will suppress legitimate warnings as well. I wrote about it in my blog:

    I would love to see it fixed...

  9. ModLunar

    Jul 16, 2020 13:06

    I'm really glad this isn't marked "By Design". Thank you, we need this fixed.

  10. KCAR

    Jul 10, 2020 16:18

    Unity 2020.2a Beta
    Problem still exists.

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.