Hi guys, now I have read the answers and that to the (clone) after instantiated objects and have followed them and my solution is semi-correct - it works on the PC but not on the phone... So, I'm building a 2d multiplayer game for android using Photon. So when I test the game, I only have 1 android so I make the phone the master and the pc the client. Now when the user presses the button on the PC the object is initiated without the (clone) after its name, whereas this doesn't seem to happen on the phone? Iv been at this for a couple of days and I have no clue why this is. Please help!
Thanks in advance for any help given!
Here is my code for reference: ` public void Player1Button()
{
player1Activated = true;
JoyStickLoading();
thiefCollectorPrefabName = "Thief(Collector)";
RPC_CreatePlayer(thiefCollectorPrefab, thiefCollectorPrefabName, thiefCollectorSpawn);
playerControlPannel.SetActive(false);
}`
So this code here is basically when the user clicks the button, the prefab name is set to Thief(Collector) and then the createplayer method is called which actually initiates the object :
private void RPC_CreatePlayer(GameObject gameObject, string prefabName, Vector2 spawnVector)
{
gameObject = PhotonNetwork.Instantiate(prefabName, spawnVector, Quaternion.identity, 0);
gameObject.name = prefabName;
}
Thanks for any help in advance!!
↧