Photon Callbacks not showing correct Custom Properties. Please help! :(

Hi there.
I am creating a turn-based multiplayer game, with persistent rooms using Photon and PlayFab (and also PlayMaker).

I can create rooms and assign Custom Properties to track the game state, but this data doesn't seem to be reflected in the callbacks being received by the PlayFab server.

Here is the relevant snippet of the PlayMaker action I am using to create the rooms...

(I tried to use the CODE tags, but for some reason it all came out as one line when I did that) .

		public override void OnEnter()
		{
			
		
			string _roomName = null;
			if ( ! string.IsNullOrEmpty(roomName.Value) )
			{
				_roomName = roomName.Value;
			}
				

			ExitGames.Client.Photon.Hashtable _props = new ExitGames.Client.Photon.Hashtable();
			
			int i = 0;
			foreach(FsmString _prop in customPropertyKey)
			{
				_props[_prop.Value] =  PlayMakerUtils.GetValueFromFsmVar(this.Fsm,customPropertyValue[i]);
				i++;
			}			
			
			string[] lobbyProps = new string[lobbyCustomProperties.Length];
			
			int j = 0;
			foreach(FsmString _visibleProp in lobbyCustomProperties)
			{
				lobbyProps[j] = _visibleProp.Value;
				j++;
			}

			RoomOptions _options = new RoomOptions();
			_options.MaxPlayers =  (byte)maxNumberOfPlayers.Value;
			_options.IsVisible = isVisible.Value;
			_options.IsOpen = isOpen.Value;
			_options.CustomRoomProperties = _props;
			_options.CustomRoomPropertiesForLobby = lobbyProps;

			if (!playerTimeToLive.IsNone)
			{
				_options.PlayerTtl = playerTimeToLive.Value;
			}

            if (!roomTimeToLive.IsNone)
            {
                _options.EmptyRoomTtl = roomTimeToLive.Value;
            }

            if (!cleanupCacheOnLeave.IsNone)
			{
				_options.CleanupCacheOnLeave = cleanupCacheOnLeave.Value;
			}

			if (!publishUserId.IsNone)
			{
				_options.PublishUserId = publishUserId.Value;
			}

			if (plugins.Length>0)
			{
				string[] _plugins = new string[plugins.Length];

				int k = 0;
				foreach(FsmString _fsmstring in plugins)
				{
					_plugins[k] = _fsmstring.Value;
					k++;
				}

				_options.Plugins = _plugins;
			}

            if (reserveSlots.Value)
            {
                //string[] slotIDs = IDArray.Values as string[];
                string[] slotIDs = new string[IDArray.Length];
                int l = 0;
                while (l < IDArray.Length)
                {
                    slotIDs[l] = (string)IDArray.Values[l];
                    l++;
                }

                PhotonNetwork.CreateRoom(_roomName, _options, TypedLobby.Default, slotIDs);
            }else
            {
                PhotonNetwork.CreateRoom(_roomName, _options, TypedLobby.Default);
            }
			
            Finish();


And here is the callback data for OnRoomCreated:


{
  "ActorNr": 1,
  "AppVersion": "1.0_1.83",
  "AppId": "3311d6d1-1323-4dd6-9b6d-17d1d40a84aa",
  "CreateOptions": {
    "MaxPlayers": 3,
    "IsVisible": false,
    "LobbyId": null,
    "LobbyType": 0,
    "CustomProperties": {},
    "EmptyRoomTTL": 12000,
    "PlayerTTL": -1,
    "CheckUserOnJoin": true,
    "DeleteCacheOnLeave": false,
    "SuppressRoomEvents": false,
    "PublishUserId": true,
    "ExpectedUsers": [
      "59FCE1AD1A872162",
      "A5F29DFD0274B092",
      "2B4680FC09C32C7"
    ]
  },
  "GameId": "257823684697",
  "Region": "CAE",
  "Type": "Create",
  "UserId": "59FCE1AD1A872162",
  "Username": ""
}


As you can see, the custom properties are blank... but I have no trouble retrieving them in Unity, so presumably they are set correctly.

When the room closes, the callback data looks like this:


{
  "ActorCount": 1,
  "ActorNr": 1,
  "AppVersion": "1.0_1.83",
  "AppId": "3311d6d1-1323-4dd6-9b6d-17d1d40a84aa",
  "GameId": "257821806028",
  "Region": "CAE",
  "State": {
    "ActorCounter": 1,
    "ActorList": [
      {
        "ActorNr": 1,
        "UserId": "59FCE1AD1A872162",
        "Username": "",
        "Binary": "RGIAAAEBRAAAAAFi/3MAAA==",
        "DeactivationTime": "2017-10-26T13:43:11.0883207+00:00",
        "DEBUG_BINARY": {
          "1": {
            "255": ""
          }
        }
      }
    ],
    "Binary": {
      "18": "RAAAAA1zAApQbGF5ZXJEaWNlcwAAYvp5AABzcwAGTW92ZTAzcwAAcwAGTW92ZTAycwAAcwAHU3RhdGUwMXMAAHMAB1N0YXRlMDBzAABzAAdTdGF0ZTAzcwAAcwAGTW92ZTAwcwAAcwAERGVja3MAPGUwNW4xZzdsYWM2aWhwcXMzbzliODJtZGpmazRydENIWHdHeU9XSXp1RXhURFJCRktBTVBRTFNWTlVKdnMAB1N0YXRlMDJzAABzAAZNb3ZlMDFzAABzAAxTdGF0ZUN1cnJlbnRzAABzAARUdXJuaQAAAAA="
    },
    "CheckUserOnJoin": true,
    "CustomProperties": {},
    "DeleteCacheOnLeave": false,
    "EmptyRoomTTL": 12000,
    "IsOpen": true,
    "IsVisible": false,
    "LobbyType": 0,
    "LobbyProperties": [],
    "MaxPlayers": 4,
    "PlayerTTL": -1,
    "SuppressRoomEvents": false,
    "Slice": 0,
    "DebugInfo": {
      "DEBUG_PROPERTIES_18": {
        "250": [],
        "PlayerDice": "",
        "Move03": "",
        "Move02": "",
        "State01": "",
        "State00": "",
        "State03": "",
        "Move00": "",
        "Deck": "e05n1g7lac6ihpqs3o9b82mdjfk4rtCHXwGyOWIzuExTDRBFKAMPQLSVNUJv",
        "State02": "",
        "Move01": "",
        "StateCurrent": "",
        "Turn": 0
      }
    },
    "ExcludedActors": [],
    "PublishUserId": true,
    "ExpectedUsers": [
      "59FCE1AD1A872162",
      "453275C8340F5E91",
      "A5F29DFD0274B092",
      "2B4680FC09C32C7"
    ],
    "RoomFlags": 9
  },
  "State2": {
    "ActorList": [
      {
        "ActorNr": 1,
        "UserId": "59FCE1AD1A872162"
      }
    ]
  },
  "Type": "Save"
}


The custom properties seem to be in the debug info for some reason (you can see the correct data in the "Deck" property).

Can somebody let me know what I am doing wrong?

Thanks,
Dan

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi @Dan,

    Thank you for choosing Photon!

    You are doing nothing wrong, it's just that you missed an important detail:
    in the current implementation, only Custom Room Properties Visible to the Lobby can be found inside the "Custom Properties" value.

    I know it's not convenient we will hopefully change this in the future but as a workaround you could expose the properties you need to the lobby and you can optionally hide them from the lobby once the room is created.
  • Hi there! Thanks for the quick reply - that's awesome!
    One last question: How do I expose properties to the lobby?
    I had a good old Google and can't seem to find any info!
    :neutral: