Set CustomProperties in State PUN2

Hello, i would like to know how to set the CustomProperties of State.
I'm using:
PhotonNetwork.CurrentRoom.SetCustomProperties(boardProps, null, new WebFlags(0) { HttpForward = webForwardToPush });

(with webForwardToPush that I set to True and False to test)

But when i get my State in the webhook playfab, the CustomProperties is empty. The only time i get the content is in Properties of the PathGameProperties webhook.

Thanks.

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi @antigode,

    The CustomProperties in the State are the lobby properties.
    So if you want room properties to be exposed in the state you need to set their keys as lobby properties using:

    before room creation:
    roomOptions.CustomRoomPropertiesForLobby = propertiesListedInLobby;
    
    or post room creation:
    room.SetPropertiesListedInLobby(propertiesListedInLobby
  • i was about to reply to my topic to say i found out about those keys. Thanks. By the way there are several errors in your code here: https://github.com/JohnTube/MemoryDemoCloudScript/blob/master/MemoryDemo.js
    The last i remember is: line 432, i think it's more a && than a || :p
    Still working with it thank you for that
  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi @antigode,

    Thanks for the fix.
    I have committed it.
    Feel free to fork and do pull requests!

    I think it's worth it if you try TypeScript though.
    It was a life changer/saver for me.
  • No problem, yeah i know for typescript but didn't think it would have been such a pain in the ass for so long ! Now i'm almost done for this part so it doesn't worth it ! I remember also at line 278,
    data = getSharedGroupEntry(getGamesListId(currentPlayerId), args.GameId); i don't know if it's only for me because i've adapted your code for my project but it returns "{gameId: data}" so for my case, i had to add [args.GameId] at the end of the line of code i quote. I don't know if it is the same for you. Have a nice day.
  • antigode
    antigode
    edited April 2019
    Hi John, you said that for persistence, keys needed to be set in the RoomOptions. Though i really don't understand why in the memo demo, there are just 2 keys set in the RoomOptions while we still can reach other properties ("pt", "tx#"....) from the CustomPropertiesRoom. Isn't it persisted too ?
  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi @antigode,

    About actor properties, I answered here.

    about the other issue in the PlayFab CloudScript, I'll look into it.