Unity + ReSharper:“字段可以设为只读”警告用于SerializeField

huangapple go评论96阅读模式
英文:

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.

huangapple
  • 本文由 发表于 2023年3月9日 22:40:01
  • 转载请务必保留本文链接:https://go.coder-hub.com/75686068.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定