Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: Microck on October 02, 2021, 12:50:09 PM

Title: Photon/PUN2 Room properties error
Post by: Microck on October 02, 2021, 12:50:09 PM
Hello there !
Does Pun get room properties and Photon network Set room custom property works with Unity 2020 ? Or maybe I don't use them correctly ?

It seems both actions do nothing.

1) Create Room advanced with custom properties "PlayerData", empty string value.
2) Player pickup an item: Build string (playerID, etc), store result as "SendInfo". And then "Set room custom property", "PlayerData" with the string "SendInfo" value.
3) Finally, get room properties "PlayerData" with the string "SendInfo" value.

Simple, but with the get room properties, the "SendInfo" value is empty.

4) Result: PlayMaker Photon proxy:  Received Callback OnRoomPropertiesUpdate Broadcasting global Event PHOTON / ON ROOM PROPERTIES UPDATE
No Data associated with this event


(See attachment picture)

Unity 2020.3.17f1, playmaker1.9.3 and PUN2 2.37 (last version).
Title: Re: Photon/PUN2 Room properties error
Post by: Microck on October 03, 2021, 06:09:34 AM
BUMP

I'd like to also point out that Playmaker PUN package (classic version) from the ecosystem is missing (I want to test the DemoWorkers sample that's why I want this package).
Title: Re: Photon/PUN2 Room properties error
Post by: Microck on October 04, 2021, 07:20:34 AM
Friendly BUMP.  ;D

I really need help for this.
At the moment, I use RPC buffered each time a player pick up an item but this is not a good thing to do, I really want to know how Set and get Room custom properties so that other players knows who pick up an item(build string: ItemID and PlayerID).

And of course, the missing Playmaker PUN package from the ecosystem.
EDIT: Package is simply here, sorry  ::) : https://hutonggames.fogbugz.com/default.asp?W928
Title: Re: Photon/PUN2 Room properties error
Post by: djaydino on October 04, 2021, 07:48:30 AM
Hi.
package is there.

Just set the filter 'Packages' and browse (don't search with a name)

(https://i.imgur.com/dDit0X9.png)

For setting up, i have no experience wit PUN but there are several people on our Discord Channel that uses PUN.
Title: Re: Photon/PUN2 Room properties error
Post by: Microck on October 04, 2021, 09:07:28 AM
Thanks ! I've never use filter, how can I miss this option since 2018 ? lol

Well after taking a look at the DemoWorker sample, it looks like what i'm doing isn't wrong but data value stay empty for the room properties.

The Pun Get room properties action give this error:

NullReferenceException: Object reference not set to an instance of an object
HutongGames.PlayMaker.FsmArray.SaveChanges () (at C:/Projects/Playmaker_1.9.1/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/FsmVariables/FsmArray.cs:350)
HutongGames.PlayMaker.FsmArray.set_Values (System.Object[] value) (at C:/Projects/Playmaker_1.9.1/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/FsmVariables/FsmArray.cs:159)

Well I guess you can't use room custom properties anymore:
https://hutonggames.com/playmakerforum/index.php?topic=20513.0
Title: Re: Photon/PUN2 Room properties error
Post by: Microck on October 05, 2021, 08:13:50 AM
So I found a workaround and I will share it with you just in case.

You can't now set/get custom properties for Room and player (NullReferenceException), those actions are kinda broken and it can be very confusing.
Instead, just use variable Network sync.

Create a special FSM: Go to Playmaker > Addons > Photon > Components > Add photon ready FSM to selected object.

Make sure your gameobject have those components: photon view + play maker photon game object proxy + play maker photon view.

Set your Photon view to manual and drag and drop your FSM (with your sync variable) to the Observed components list. Now photon can use your sync variable, and it works with players who join the game later.

Note for the "IPunObservable" error: In the Observed components list, make sure you don't observe the Play maker photon view itself (it is added by default, delete it from the list).
Also, put all your variables sync in the same FSM of the gameobject. If you put variables sync inside multiple FSM on the gameobject, you will have some errors.
Title: Re: Photon/PUN2 Room properties error
Post by: zori on December 23, 2021, 03:53:10 PM
I can confirm these actions are really broken, I am unable to get properties and also to join random room with given properties. Using unity 2020.3
Title: Re: Photon/PUN2 Room properties error
Post by: Hayato on September 22, 2022, 11:23:21 AM
I confirm PUN2 PunGetRoomProperties works in Unity 2021.3.39f1 but it will cause a break due to a array error if "ExceptedUsers" keep under default value "none" .

(https://images.plurk.com/4s4IioLIL5Cd9HHu8Ce7mh.png)

There is a workaround :

Everytime you add a PunGetRoomProperties action ,
Creat a string array variable and set to ExceptedUsers , then set it back to "None" .

Now the action work well without break , you can also delete the array variable after workaround .

(https://images.plurk.com/4UPaXiJhAz0ZyQK391IMko.png)



Title: Re: Photon/PUN2 Room properties error
Post by: djaydino on September 24, 2022, 01:57:42 AM
hi could you send the script here for that action.
I can have a look if i can fix the script itself
Title: Re: Photon/PUN2 Room properties error
Post by: Hayato on September 24, 2022, 08:26:28 AM
hi could you send the script here for that action.
I can have a look if i can fix the script itself

I just use PunGetRoomProperties actoin included in PUN2 package download from ecosystem (and updated before the post ) .