resharper-unity
resharper-unity copied to clipboard
Validate correct constructor for Unity serialised types
Figure out the rules for constructors and Unity serialised types (MonoBehaviour or [Serializable]). Do these types require a default constructor? If a user creates a non-default constructor, should we add a highlight to also add a default constructor?
Should definitely highlight non-default constructor, because this can cause field initialisers to not run - the compiler rewrites these to be part of the constructor, and Unity will only invoke a non-default constructor.