#Readers/Writers missing in build (works in Editor) after Unity 6 upgrade

28 messages · Page 1 of 1 (latest)

versed lily
#

After upgrading from Unity 2021 LTS to Unity 6000.0.46f1, I'm running into issues where Mirror NetworkMessage Readers/Writers are not generated in builds (tested in both IL2CPP and Mono).

In the Editor, everything works perfectly.
In the Standalone build, I get null reference exceptions when sending/receiving custom messages — indicating the serializers aren’t registered.

I'm using an old Mirror version, no manual message registration, no additive scenes, no special scripting defines.
This used to work 100% in Unity 2021.

Has anyone hit this in Unity 6 or know a workaround?

I highly believe at some point (either when mirror added Unity 2022 or Unity 6 Support) there were changes on how the writers/readers were generated, do you have any tips for me?

versed lily
#

Did some further testing, just by going from Unity 2021 LTS to Unity 2022 LTS, the issue happens.
If I take the same project that I tested on 2022 and go back to Unity 2021 LTS version, it works again. So probably has mostly to do with 2021 --> 2022 than Unity 6 itself.

fading elk
# versed lily After upgrading from Unity 2021 LTS to Unity 6000.0.46f1, I'm running into issue...

These 2 paragraphs seem to contradict each other

In the Editor, everything works perfectly.
In the Standalone build, I get null reference exceptions when sending/receiving custom messages — indicating the serializers aren’t registered.

I'm using an old Mirror version, no manual message registration, no additive scenes, no special scripting defines.

No idea how old your Mirror is, but I'm certain Discord would be blowing up if no one could make working builds. Obviously that's not happening, and everyone's been building fine in 2020 through 6000 even now.

versed lily
fading elk
#

Then something else is failing on the server that's preventing the startup from completing to the point of registering those

versed lily
#

Right, but I have issues on both my builds (client & server) if I don't play through the editor (on Unity 2022 or +)

It's as if the weaver isn't registering the Readers and Writers during build time, or if some code is being stripped out (even though my managed stripped is setting to Disabled)

#

it's giving different results when building with 2021 ✅ vs 2022 ❌, but on editor it ALWAYS works fine on both versions

fading elk
#

You haven't provided the errors (https://pastie.io/) nor what version you're on, so I couldn't begin to guess.

#

just to mention, weaver only pertains to things with attributes in user code, e.g. Cmd / ClientRpc / SyncVar, where we have to inject extra code to make them work. The rest in your list weaver has nothing to do with...they're passed straight from the transport to the message unpacker and Mirror's c# handlers.

versed lily
versed lily
# versed lily https://pastie.io/leuxyp.tex I get this on the server **Mirror Version:** 23.0....
        /// <summary>
        /// Writes any type that mirror supports
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="value"></param>
        public void Write<T>(T value)
        {
            Writer<T>.write(this, value); // cs:178
        }``` That's `Mirror\Runtime\NetworkWriter.cs:178` 
and on this case, "value" is carrying a mirror's built-in struct from `Messages.cs`
```csharp
public struct ConnectMessage : NetworkMessage
{
}
fading elk
#

This isn't going to make you happy, but I can't begin to support Mirror that old

#

I'm sure we prompted you to get current and stay current over the years.

versed lily
#

yeah, that's why I asked something more generic, like, if you guys noticed anything strange with the code stripping on Unity from 2021 to 2022

#

if you have any info on that, it would help a lot

fading elk
#

You said that was disabled, so likely not even relevant, but no, don't think that's really come up.

versed lily
#

sad...
I might try to upgrade Mirror again, when I tried years ago I attempted several versions and had to roll back due to intermittent errors

fading elk
#

jumping from 23 to 96 in one go will be very hard

#

Stepping your way up by version using the links in the ChangeLog would be better

#

I'm pretty certain you'll have network components reset too along the way, so be prepared to review them for settings changes

versed lily
#

my biggest enemy is the ProximityChecker, I remember vis2k changing a lot about it and me not being able to apply my previous logic due to how observers is working on the new mirror

fading elk
fading elk
versed lily
#

I believe this post issue had to do with Mirror's old post-processors

#

after 2 weeks of pure insanity, I was able to go from mirror 23 to mirror 96

#

the errors of this post went away

versed lily