If assembly has struct with FieldOffset, Odin silently stops to draw any Inspectors/Edtitor windows within the assembly

Issue #771 open
Mikhail Korchun created an issue
  1. Odin silently stopped to draw any inspectors for the types within the assembly, at least under asmdef
  2. Put the Union.cs script inside the project (attached). Notice scripts from this assembly start to draw with default Unity inspectors, instead of Odin. Same goes for the Editor windows.
  3. No, you will just see Odin Inspector stops drawing any user types
  4. 2020.2.3f1
  6. No
  7. Win 10

Comments (3)

  1. Tor Esa Vestergaard

    Very strange behaviour! It seems that Unity entirely stops allowing the use of custom editors of any kind at all for types in that assembly, meaning we cannot really do much about the issue.

    I checked and Odin is assigned to the correct types in the internal custom editor mapping, but Unity is not using that mapping and instead just hard-defaulting to a default inspector for it instead. As such, this is a Unity issue that I would recommend be reported for a fix to happen. I can perhaps find time to cook up a decent bug report for this during the next week - but I’d encourage you to report it yourselves as well.

    Additionally, I can add that it seems everything starts working if you do not make the struct generic, so it is the combination of an explicitly layouted struct that is also generic which is the thing that breaks Unity here.

  2. Mikhail Korchun reporter

    Thank you for investigating it further!

    I can add that it seems everything starts working if you do not make the struct generic

    Yes, I tried it also while was narrowing down the repro case for you.

    But the whole point was to make sort of “discriminated unions“ API, so generic is a must.

  3. Log in to comment