- Home /
How to destroy a match unity networking
First off, I am using Unity 5.3.0f4, and I think that will matter.
After searching around for quite a bit, I could not find a straight answer on how to destroy a match once I leave. If, for example, a player joins a multiplayer lobby and then leaves, my game currently waits for the connection to time out, and then destroys the match. The problem is that during that timeout period, other players will join the broken match, and then there will be lots of problems. I want to destroy the match when a player leaves the scene.
If I have the MatchInfo (from manager.matchMaker.CreateMatch, or manager.matchMaker.JoinMatch) stored, what should I do to destroy the match I am currently in?
Also, if it is nessisary, how to I story the MatchInfo object that, according to the documentation (http://docs.unity3d.com/ScriptReference/Networking.Match.MatchInfo.html) is returned in methods mentioned above? Simply casting did not work for me, as it seemed to return a corutine instead of a MatchInfo object, unless I was doing something wrong. Thanks :)