Can connect editor but not on iphone

Options
Hi guys,

In my editor I can create and join a room.

But when I build and deploy to my iphone It won't connect. Here is my code.

Any idea where to start looking for the problem?

Here is my complete code (ignore commented out sections). I created a text object - DebugText - to act as a debugger. It doesn't get to the OnJoinedRoom() function when used on my phone. So it never moves to the lobby scene:


using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
using Photon.Pun;
using Photon.Realtime;

public class MenuController : MonoBehaviourPunCallbacks
{

[SerializeField] private string VersionName = "0.1";
[SerializeField] private GameObject UsernameMenu;
[SerializeField] private GameObject ConnectPanel;
[SerializeField] private GameObject StartButton;

[SerializeField] private InputField UsernameInput;
[SerializeField] private InputField CreateGameInput;
[SerializeField] private InputField JoinGameInput;



public Text DebugText;

//private int roomSize; //manuallys set room size


private void Awake()
{
PhotonNetwork.ConnectUsingSettings();
DebugText.text = "awake";
}

public override void OnConnectedToMaster() // callback function for when first connection is made
{
//PhotonNetwork.JoinLobby(TypedLobby.Default);
//PhotonNetwork.AutomaticallySyncScene = true;
Debug.Log("Connected");
DebugText.text = "connected";
}


public void ChangeUserNameInput()
{
if (UsernameInput.text.Length >= 3)
{
StartButton.SetActive(true);
}
else
{
StartButton.SetActive(false);
}
}

public void SetUserName()
{
UsernameMenu.SetActive(false);
PhotonNetwork.NickName = UsernameInput.text;
}

public void CreateGame()
{
DebugText.text = "Button Pressed. Create Game Started";
//if (PhotonNetwork.NetworkClientState == ClientState.ConnectedToMasterServer)
//{
Debug.LogError("About to connect");
//RoomOptions createRoomOps = new RoomOptions() { IsVisible = true, IsOpen = true, MaxPlayers = 4 };
//PhotonNetwork.CreateRoom(CreateGameInput.text, createRoomOps);
PhotonNetwork.CreateRoom(CreateGameInput.text, new RoomOptions() { MaxPlayers = 4 }, null);

DebugText.text = "Create gamer called";
//}
// else
// {
// Debug.LogError("Can't join random room now, client is not ready");
// }



}

public void JoinGame()
{
DebugText.text = "Button Pressed. Join Game Started";

RoomOptions roomOptions = new RoomOptions();
roomOptions.MaxPlayers = 4;
PhotonNetwork.JoinOrCreateRoom(JoinGameInput.text, roomOptions, TypedLobby.Default);

DebugText.text = "Join game called;
}

//public override void OnCreatedRoom()
//{
// Debug.LogError("Room Created");
// PhotonNetwork.LoadLevel("Map1");
// }

public override void OnJoinedRoom()
{
Debug.LogError("Room Joined");
DebugText.text = "OnJoinedRoom function run";
PhotonNetwork.LoadLevel("Lobby"); // change this to lobby
//SceneManager.LoadScene( ) //maybe use scenemanager
}

}

Comments

  • Tobias
    Options
    The code is not as interesting as the logs from device. We don't "debug" code usually.
    Please enable the SupportLogger, try again and send the logs.
  • lxg
    Options
    Thank you I will do that next time.

    Update: this was an issue with unity cloud which i was using to build and deploy to iphone. I ended up getting a mac, transferring the build across and deploying through xcode and everything works fine.