Placeholder-Software / Dissonance

Unity Voice Chat Asset
69 stars 5 forks source link

#if UNITY_EDITOR used on SerializedFields #184

Closed Alexees closed 4 years ago

Alexees commented 4 years ago

Context

I just updated Dissonance For Mirror Networking to 6.4.5 and realized that there are a couple of #if UNITY_EDITOR added to SerializedFields. Please don't do that. When compiled, the script layout will be different from the serialized data (unless you managed to serialize after recompilation) and will cause of lot of these when running the build: "A script behaviour has a different serialization layout..."

Expected Behavior

No layout difference spam in build

Actual Behavior

spam

Workaround

I usually just keep the serialized fields and wrap them in #pragma warning disable 414. I think the only other way is to save that data elsewhere, per instance.

Fix

Have no idea

Steps to Reproduce

build and watch the console

Your Environment

martindevans commented 4 years ago

Thanks for reporting this.

I've just checked and for some reason I don't see these warnings in the log when I build the player (2018.4.17f1). I don't really need a reproduction to fix this though - I'll remove those #if blocks for the next version of Dissonance.

Alexees commented 4 years ago

Does not happen when building, does happen when then running

martindevans commented 4 years ago

Sorry for the long delay with this issue! Dissonance 7.0.1 has finally been released which removes the #if UNITY_EDITOR blocks around serialized state.