Hello,
I have been trying to solve this issue now for a couple of hours, and I can't seem to find out what is causing it. My code looks exactly like it does in the "Example Creation" scene, and my TNObjects isMine is always false when I am connected to a server. However, if I am NOT connected to a server, they seem to be working.
Here is what the TNObject looks like in the inspector when I am connected to a server (gyazo link):
https://gyazo.com/d74f3d8b16cdc31f4b1f97fcdddf70f8Here is my code:
*Network Manager*
private void OnConnect(bool success, string message)
{
//Debug.Log("OnJoinedRoom: " + PhotonNetwork.room.Name + " | Players: " + PhotonNetwork.room.PlayerCount + "/" + PhotonNetwork.room.MaxPlayers);
Debug.Log("OnConnect Message: " + message);
if(success == true)
{
// Set "inRoom" to true
inRoom = true;
// Instantiate LobbyController when joined room
//PhotonNetwork.Instantiate("LobbyController", Vector3.zero, Quaternion.identity, 0);
TNManager.Instantiate(0, "RCCLobbyController", "LobbyController", false, Vector3.zero, Quaternion.identity);
}
[RCC]
static GameObject RCCLobbyController(GameObject prefab, Vector3 pos, Quaternion rot)
{
GameObject go = prefab.Instantiate();
// Set the position and rotation based on the passed values
Transform t = go.transform;
t.position = pos;
t.rotation = rot;
return go;
}
Here is the script for the lobby controller that is attached to the instantiated object:
private void Start()
{
if(tnObject.isMine == true)
{
Debug.Log("isMine");
tnObject.Send("RPCMakePlayerCard", Target.AllSaved, playerName);
networkLobby.readyToggle.onValueChanged.AddListener(SetReady); // Add Toggle onValueChanged() Listener for Ready
networkLobby.launchButton.onClick.AddListener(PhotonLoadLevel); // Add Button onClick() Listener for launching game
}
else
{
Debug.Log("Not mine");
}
}
As you can see, the "isMine" check is happening in the Start method of the Instantiated Object, so to my understanding, the TNObject has already been initialized and everything should be working. I feel like I am missing something so obvious.
Thanks,
Gabe