Playmaker Forum

PlayMaker Updates & Downloads => Share New Actions => Topic started by: MABManZ on October 02, 2015, 01:03:43 PM

Title: Photon Get Ping
Post by: MABManZ on October 02, 2015, 01:03:43 PM
Here is a simple action that will ping your Photon server and output as int or a string

Code: [Select]
using UnityEngine;

namespace HutongGames.PlayMaker.Actions
{
[ActionCategory("Photon")]
[Tooltip("Recieves Player Ping and Stores in a String")]
[HelpUrl("https://hutonggames.fogbugz.com/default.asp?W1136")]
public class PhotonGetPing : FsmStateAction
{
[RequiredField]
[Tooltip("")]
public FsmInt ping;
public FsmString pingString;

public override void Reset()
{
ping = null;

}

public override void OnEnter()
{
DoGetPing();
Finish();
}

void DoGetPing()
{

ping.Value = PhotonNetwork.GetPing ();
pingString.Value = ping.Value.ToString();

}

}
}
Title: Re: Photon Get Ping
Post by: zorranco on November 02, 2015, 08:38:17 AM
Very usefull, thanks
Title: Re: Photon Get Ping
Post by: jeanfabre on November 23, 2015, 07:52:36 AM
Hi,

 it's now part of the package on the wiki (http://j.mp/1IIXNRS) and Ecosystem (http://j.mp/1Esn1mF).

Thanks for your contribution!


 Bye,

 Jean