JetBrains / JetBrains/resharper-unity

Add highlight for serialised field with same name as serialised field in base class

Open
#2,184 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
1.2k
Forks
142
PR merge metrics
No merged PRs in 30d

Description

If we have a base class with a private serialised field called `MySerialisedField` and a derived class that also has a serialised field called `MySerialisedField`, then the code will compile, but Unity will fail to serialise the class hierarchy, due to the name clash.

Rider/ReSharper will show a gutter icon and add a warning that the `new` keyword is required if the base class' field is not private. The Unity plugin should add a similar warning when the base class' field is private. We already do a similar thing for event functions. E.g. if the base class defines a private `Update` function and the derived class also defines `Update`, we add the gutter icon (but no warning. We might want to reconsider that).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.