playMaker

Author Topic: [SOLVED] C# Script to get PUN 2 Player count and Room Name  (Read 152 times)

heavygunner

  • Sr. Member
  • ****
  • Posts: 340
    • View Profile
[SOLVED] C# Script to get PUN 2 Player count and Room Name
« on: July 19, 2021, 03:38:49 AM »
Hello,

I wanna get Room Name and Players Count in room. Unfortunately, Pun Get Room Properties action giving result with one error in Console. My project isn't located at C:

Unablke to proceed on game due to this issue.  :'(
See the errors and give me a fix. Thanks

Quote
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)
HutongGames.PlayMaker.Pun2.Actions.PunGetRoomProperties.getRoomProperties () (at Assets/PlayMaker PUN 2/Actions/PunGetRoomProperties.cs:146)
HutongGames.PlayMaker.Pun2.Actions.PunGetRoomProperties.OnEnter () (at Assets/PlayMaker PUN 2/Actions/PunGetRoomProperties.cs:104)
HutongGames.PlayMaker.FsmState.ActivateActions (System.Int32 startIndex) (at C:/Projects/Playmaker_1.9.1/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/FsmState.cs:222)
HutongGames.PlayMaker.FsmState.OnEnter () (at C:/Projects/Playmaker_1.9.1/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/FsmState.cs:192)
HutongGames.PlayMaker.Fsm.EnterState (HutongGames.PlayMaker.FsmState state) (at C:/Projects/Playmaker_1.9.1/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:3072)
HutongGames.PlayMaker.Fsm.SwitchState (HutongGames.PlayMaker.FsmState toState) (at C:/Projects/Playmaker_1.9.1/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:3011)
HutongGames.PlayMaker.Fsm.UpdateStateChanges () (at C:/Projects/Playmaker_1.9.1/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2944)
HutongGames.PlayMaker.Fsm.UpdateState (HutongGames.PlayMaker.FsmState state) (at C:/Projects/Playmaker_1.9.1/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:3088)
HutongGames.PlayMaker.Fsm.Update () (at C:/Projects/Playmaker_1.9.1/Projects/Playmaker.source.unity/Assets/PlayMaker/Classes/Fsm.cs:2231)
PlayMakerFSM.Update () (at C:/Projects/Playmaker_1.9.1/Projects/Playmaker.source.unity/Assets/PlayMaker/PlayMakerFSM.cs:624)
« Last Edit: July 19, 2021, 04:07:06 AM by heavygunner »

heavygunner

  • Sr. Member
  • ****
  • Posts: 340
    • View Profile
Re: [SOLVED] C# Script to get PUN 2 Player count and Room Name
« Reply #1 on: July 19, 2021, 04:07:52 AM »
I solved it.
Use Create Room Advanced action and set a lobby name. That's all
Now, you can get room properties without any issues