How to sync a script so all players can see it the same?

Options

Im still new to photon, so sorry if its a dumb question. Basically i have a public script in a scene that has a list of cubes variable. Everytime a player clicks something a cube spawns and that cube is putted into the list. It works fine, but my problem is that i want every other player that uses that public script to also see that a cube was added. The problem is that it only updates to every player individiaully.


This is the public script in the scene thats not spawned in. It has just this variable

public List<GameObject> ColllisionBoxes;


And this is a script every player has individually, and every time a mouse is clicked it does this. Which works fine, but only individiually. I want it to update for every player

 playerUI.Manager.ColllisionBoxes.Add(g.GetComponent<Tower>().towerCollisionBox);

Answers

  • Gernermale
    Options

    To be more clear, every player has a spawner script. Player presses left click and the spawner script is triggered. The spawner script spawns the cube and adds it into the gamemamanger list. Gamemanager list only updates the player that spawned that cube, but the second player that didnt do anything doesent have that information that a list was updated, only the first player does.