- Home /
Networking - Unity stuck by pressing play button in editor 2018 2
Hi guys,
Using both photon or unet (with vr) with latest unity versions 2018 series I got a unity stuck by pressing play button (often), without any error or useful messages (yes even in editor logs in .../AppData/Local/Unity/Editor/editorlog.txt)
This is not a simple unity-not-responding, otherwise a process kill would be enough to solve it. This makes the process from task manager not killable so I have to restart rawly the pc. I tried all things to kill that process but it ever remains as background process if not under the main-ones.
Any suggestion/help?
Answer by Cippman · Oct 11, 2018 at 03:04 PM
Reproducibility with unet or photon: 1) Enable vr support for your project 2) Create a code for match creation / joining code UNET example like in documentation - https://docs.unity3d.com/ScriptReference/Networking.Match.NetworkMatch.html - https://docs.unity3d.com/ScriptReference/Networking.Match.NetworkMatch.CreateMatch.html
code preview in text editor of reply is really better than how it looks here
public class ConnectionHandler : MonoBehaviour { /// <summary> /// Assign the manager from inspector. /// </summary> public NetworkManager manager; private void Start() { manager.StartMatchMaker(); CreateInternetMatch("Test"); } //call this method to request a match to be created on the server public void CreateInternetMatch(string matchName) { manager.matchMaker.CreateMatch(matchName, 20, true, "", "", "", 0, 0, OnInternetMatchCreate); } //this method is called when your request for creating a match is returned private void OnInternetMatchCreate(bool success, string extendedInfo, MatchInfo matchInfo) { if (success) { Debug.Log("Create match succeeded"); MatchInfo hostInfo = matchInfo; NetworkServer.Listen(hostInfo, 9000); manager.StartHost(hostInfo); } else { Debug.LogError("Create match failed: "+extendedInfo); } } }
3) for photon happens the same I just followed their examples demos and docs by only changing the aim of ConnectAndJoinRandom to ConnectAndJoinASpecificRoom .