Unity reports warning CS0649: Field ‘...‘ is never assigned to,...Solution

1. Phenomenon

Insert image description here

2. Reasons for warnings

This warning should only appear for private member variables. Those cannot be set externally, which is why the compiler can determine that these variables don't have their values ​​anywhere. In C#, variables without access modifiers (private, protected, public...) are always private.
Insert image description here

3. Solution

Add the file csc.rsp under the assets folder and write

-nowarn:0649

Guess you like

Origin blog.csdn.net/weixin_45136016/article/details/134170943