0

I am little bit struggling with the Photon PUN 2 Unity Version 21.3.4f1. I want to make easy game where 2 players guessing letters from the secretary. Everything works good, but now I find the problem that my little brain cant solve :D I want to add some string values for the buttons and then every player can take values from button when they clicked on it. My problem is that I need to add same values to both players.I take values randomly from string List. So I tried view.IsMine and PhotonNetwork.IsMasterClient, function which adding values to the buttons is RPC. Have you some ideas how to solve it? I dont need all code for this, just some tips how to add same values to both players. Buttons are statically in scene, I am not instatiate them realtime.

Just for example this is my code for adding values to some buttons:

for (int i = 0; i < button3b_value.Count; i++)
{
    List<string> filteredStrings = threePointsLetters.Except(usedLetters).Except(button3d_value).ToList();
    if (filteredStrings.Count == 0)
    {
        Debug.LogWarning("No possible 3 point letter in List");
    }
    else
    {
        int index = UnityEngine.Random.Range(0, filteredStrings.Count);
        button3b_value[i] = filteredStrings[index];
    }
}

And I need to play this part of code only on the one player or on the server. And then button3b_value send to each player. Because now both players take different values from threePointsLetters List. I will be grateful for any advice

V1lko
  • 53
  • 8

0 Answers0