Instantiate don't work correctly on Custom Rooms
Options
This is the code that creates the game
I can create a Game Object whitout problems like this
The problem is when other player is in the room and they leave the game, instead of destroy all gameobjects instantiated by he, it gives the ownership to the local player and calls they "Owner [0]" instead " "Owner[1]"
I tried the same in a Room without custom properties and it works correctly, destroying all game objects that he has not created
So, I'm really confused about this.
ExitGames.Client.Photon.Hashtable customPropreties = new ExitGames.Client.Photon.Hashtable(); customPropreties["GameMode"] = "DeathMatch"; RoomOptions roomOptions = new RoomOptions() { CustomRoomProperties = customPropreties, IsVisible = true, IsOpen = true, MaxPlayers = 10, CleanupCacheOnLeave = false }; roomOptions.CustomRoomPropertiesForLobby = new string[] { "GameMode", }; PhotonNetwork.CreateRoom("Room" + Random.Range(0, 1000), roomOptions);
I can create a Game Object whitout problems like this
void Update() { if (Input.GetKeyDown("t")) { PhotonNetwork.Instantiate("MovementP", new Vector3(0, 0, 0), Quaternion.identity, 0); } }
The problem is when other player is in the room and they leave the game, instead of destroy all gameobjects instantiated by he, it gives the ownership to the local player and calls they "Owner [0]" instead " "Owner[1]"
I tried the same in a Room without custom properties and it works correctly, destroying all game objects that he has not created
So, I'm really confused about this.
0
Comments
-
Ok, problem solved. I only need to put CleanupCacheOnLeave = true instead of false.
I'm stupid.0