英文:
Unity + ReSharper "Field can be made readonly" warning for SerializeField
问题
ReSharper在使用带有SerializeField
属性的私有字段时会发出警告“字段可以被设置为只读”,例如:
[SerializeField] private Sprite _sprite = null;
我该如何修复这个问题?
英文:
ReSharper gives a warning Field can be made readonly
when using private fields marked with the SerializeField
attribute, e.g.:
[SerializeField] private Sprite _sprite = null;
How can I fix this?
答案1
得分: 0
如果您正在使用Visual Studio,请安装Unity Support ReSharper扩展。
另外,请确认是否已安装,如果您最近重新安装或更新了ReSharper。
英文:
If you are using Visual Studio, install the Unity Support ReSharper extension.
Also, confirm that it's installed if you recently re-installed or updated ReSharper.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论