Beginner Help! How to access a Component from the other player in the same room

Hi All!

Beginner Unity user here. I am making a simple multiplayer card game prototype. Two players join the same room (Max num of players in room set to 2). Game scene is loaded.

The game scene has a logic in start method, which randomly picks a list of sprites and displays it on screen. The problem is for both the players the list of sprites are different. (meaning the scene is independently loaded in both devices and random logic is causing different sprites)

Is there some way that the second user who connects to the room access the list of sprites generated for the master in the room? so that the sprites displayed for both the users are the same.

Appreciate your help

Thanks,
Karthik

Comments

  • I don't know the entire logic of your application but one think you can try out is instantiate the sprites as networked gameobjects so that they are the same for all players in the room. Use PhotonNetwork.Instantiate instead of Unity's Instantiate method to generate the sprites