Skip to content

Serialised fields require correct type #1720

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Jun 30, 2020

Conversation

citizenmatt
Copy link
Member

@citizenmatt citizenmatt commented Jun 30, 2020

This PR implements the rules of the Unity serialiser, so that only fields with a correct type will be recognised as serialised fields.

If the field does not have the proper type, it is not recognised as a serialised field, is not marked as implicitly used, does not get a gutter icon/code vision marker, and is not highlighted as an implicitly used identifier.

The rules are taken from the Unity docs, with the addition that Unity 2020.1 allows serialising fields with generic type. This isn't documented, but is mentioned in this blog post. There is also special treatment for System.Version, which appears to be have specific handling in Unity - Mono marks it as serialisable, but netstandard doesn't - Unity treats it as non-serialisable, and so does Rider.

This PR also moves a couple of files around, and updates the tests to support Unity 2019.3, 2019.4 and 2020.1, which means lots of file changes… There are also fixes to the attributed method signature test analyser, which the updated tests highlighted.

@citizenmatt citizenmatt added this to the Rider 2020.2 milestone Jun 30, 2020
@citizenmatt citizenmatt requested a review from van800 June 30, 2020 13:34
@citizenmatt citizenmatt self-assigned this Jun 30, 2020
@citizenmatt citizenmatt marked this pull request as ready for review June 30, 2020 13:41
@citizenmatt citizenmatt merged commit b3a6a59 into net202 Jun 30, 2020
@citizenmatt citizenmatt deleted the feature/serialise-field-types branch June 30, 2020 21:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants