JetBrains / JetBrains/resharper-unity

Detect 'OdinSerialize' attribute as an alternative to 'SerializeField' (Odin Serializer support)

Open
#1,371 0 comments 6 reactions 1 assignee Claimed by @krasnotsvetov View on GitHub
Dominant language
C#
Stars
1.2k
Forks
142
PR merge metrics
No merged PRs in 30d

Description

[Odin Serializer](https://github.com/TeamSirenix/odin-serializer) is a popular serialization alternative for the Unity Editor which allows much more complex types to be serialized in components, editor windows and scriptable objects. It can serialize interfaces, derived types, generics, and more.

For the most part this works fine with the Jetbrains Unity plugin which doesn't do much with serialization anyway, however there is one feature in particular which doesn't play nice. As you know, marking a field with `SerializeField` will disable some inspections/warnings about values being unset, since they will be filled through the editor's inspector. `SerializeField` can also be used with Odin Inspector in most cases, but...

* In rare circumstances we have to use the explicit `OdinSerialize` attribute instead.
* In rare circumstances again, we sometime have to specify both `OdinSerialize` and `NonSerialized` in order to get Odin to serialize the field without Unity's serialization kicking in and resulting in double serialization.
* IIRC `OdinSerialize` can also be used on properties, although I've never used it and I don't think many people do.

It would be nice if we could have both of these cases built into the Unity plugin so we get the same features which come with regular Unity serialized fields, when a field has `SerializeField` or is public.

I'm not sure myself if the Unity plugin should have features unique to certain Unity plugins, (since that can be a slippery slope) but I'll leave it up to you to decide.

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.