2

According to what I looked up online, most of the examples take in one parameter which is a single Hashtable. However, I kept getting an error saying there is no overload method that takes only one argument. It requires three. This is the example I came up with but I still get an error saying it has invalid arguments.

How do I use room.SetCustomProperties?

public void PlacingStone ()
{
    Hashtable setPlacingStone = new Hashtable {{ RoomProperties.PlacingStone, true }};
    Hashtable currentValues = new Hashtable {{ RoomProperties.PlacingStone,
    (bool) PhotonNetwork.room.customProperties [ RoomProperties.PlacingStone ] }};
    PhotonNetwork.room.SetCustomProperties ( setPlacingStone, currentValues, true );

    StartCoroutine ( "WaitOnStone" );
}
Danny Herbert
  • 2,002
  • 1
  • 18
  • 26
Shawn Ray
  • 47
  • 2
  • 8

2 Answers2

3

Your problem is that you are trying to use multiple hashtables. You can add different things to hashtables by doing:

PhotonNetwork.room.SetCustomProperties(new ExitGames.Client.Photon.Hashtable() { 
    { RoomProperties.PlacingStone, true }, { RoomProperties.PlacingStone,
    (bool) PhotonNetwork.room.customProperties [ RoomProperties.PlacingStone ] } });

or

Hashtable t = new Hashtable();
t.Add(RoomProperties.PlacingStone, true);
t.Add(RoomProperties.PlacingStone, (bool) PhotonNetwork.room.customProperties [ RoomProperties.PlacingStone ] );
PhotonNetwork.room.SetCustomProperties(t);
xplatinumx15
  • 101
  • 3
0

Thanks! The problem was the Photon Hashtables. I need to use those as you said and I also added using Hashtable = ExitGames.Client.Photon.Hashtable; at the top of the page to make it easier.

using Hashtable = ExitGames.Client.Photon.Hashtable;

public void SetProperties () {
  Hashtable setPlacingStone = new Hashtable {{ RoomProperties.PlacingStone, true }

PhotonNetwork.room.SetCustomProperties ( setPlacingStone );

    StartCoroutine ( "WaitOnStone" );
}
Shawn Ray
  • 47
  • 2
  • 8