- Home /
How to workaround Unity Multiplayer's Host Migration bug?
TL;DR:
Host migration is broken, confirmed/reproduced by QA back in June, seeking a workaround and possibly a chime from a dev :)
THE BACKGROUND:
Host migration is currently broken in Unity, reproduced by a Unity QA staff member, Gintautas -- I have had this open ticket for ~4 months now and still goes unresolved. I try to follow-up monthly, however, the past couple emails have not been responded to since Aug 9, even with follow-ups, and I fear a workaround is necessary now:
Has anyone here successful got host migration working? What did you do to workaround this issue?
Any Unity staff able to chime in? I am starting to worry this issue isn't getting any attention (the last time I followed up, someone responded saying it's "working as intended" until I mentioned Gintautas, then responded back saying it's still a bug - deducting by the replies that the issue is likely untouched) - it's quite serious and a core feature to Unity's Multiplayer system! We don't want to be like Borderlands :P Host leaves/disconnects and .... well, no game anymore and a lot of mad people :/
THE ISSUE (TL;DR in bold):
Connect 3 clients, the 3rd client should be in the Unity Editor so you can see the objects.
Click the spawn players button. Click the change colors button.
The Top 3 Cubes will be spawned with SpawnPlayer(). The Bottom 3 Cubes will be spawned with SpawnWithClientAuthority().
Disconnect the host client.
Notice how the Top Cubes are still enabled, and the Bottom Cubes are disabled. It would be nice if they both stayed enabled, but that could easily be worked around.
Reconnnect the remaining 2 clients to each other.
The Top Cubes are reconnected properly. Notice how there is only a single Bottom Cube, the one that the host has authority with.
On the non-host client the Cube is not the same one as before the connection was lost. It is no longer green and you can see in the Editor that there are now 7 Cubes. Unity has spawned a new Cube object with none of the information from the previous one.
We need the Bottom Cubes to behave the same way as the Top Cubes. There is clearly a difference.
The Bottom Cubes should stay enabled when disconnected.
The Bottom Cubes should be reconnected instead of a new instance being spawned.
Even if we didn't want the disconnected host's objects to be reconnected, it still only spawns the host's Cube.
This happens when the autocreate players feature in the Network Manager is disabled, which is what we are going to be working with in our game.
If autocreate player is on then the Top and Bottom Cubes work the same, but they only reconnect the connected clients' objects.
It's sad to see that there is no reply to this very important feature for Unet multiplayer :(
Have you got any mail responses yet ?
Also, do you know anything about what I posted here ?
Thanks
plus1 for poor document and example (at least for Host $$anonymous$$igration)
Yeah, ditch the still crappy Unity Networking system and switch to Photon. It is awesome and pretty much solved all my issues :D
I wish. What's sad is this is still being advertised as a "feature", yet Unity doesn't answer ANY questions regarding to host migration, hlapi, unet, matchmaking, lobby or anything pre-game really. Not even the docs are updated (1.5 years old)!
$$anonymous$$y complaint thread >> https://forum.unity3d.com/threads/unity-hello-is-there-anybody-out-there-p.445978/
As for Photon @paulsz , I'd LOVE to ... but we're in too-deep. It's all coded for UNET. Although I'm going to 99% use UNET Thunder ;D Last year, Photon had THE WORST demo full of errors, so that caused us to ditch them. At that time, they barely updated too. I think they stepped up their game with UNET co$$anonymous$$g out.
Your answer
Follow this Question
Related Questions
Unity networking tutorial? 6 Answers
Unity crashing... For some reason 2 Answers
Enemy follow tag 1 Answer
Multiplayer FPS Tutorial 1 Answer
Fighting game script? 0 Answers