Unity Console warning CS0649 "Field is never assigned" and [SerializeField]
Completed
In Rider there is no warnings and along with [SerializeField] properties I see "Set by unity" tooltip, but in Unity console I got a bunch of warnings.
Well... about 80 warnings for now
Please sign in to leave a comment.
This is a Unity bug AFAIK. I've solved it this way:
Create file named:
csc.rsp
Put inside the file this content:
-nowarn:0649
Then put this file into your Assets folder.
No more 0649 warnings in the editor =)
Do you know maybe do they have plans to fix this? I don't think I encountered this issue before, this might be introduced in Unity 2018 lifecycle.
Thanks for your solution! I'll use it for now with hope to get a fix from unity team :)
@Andrew
this is not a Unity bug (unfortunately). It is a "side effect" of Unity switching over to Roslyn.
Mono (the old c# compiler) never emitted those warnings before because it had a bug which we benefited from. The good news is the Roslyn devs are aware of this issue and are working on a fix for us.
The issue with the csc.rsp file is that it will suppress all 649 warnings globally. For now I solve it by enclosing all my [serializedField] in
My solution is to simply initialize the value and then get resharper to ignore the setting of the value like so: