GUI strange behaviour...

hi folks, I have a strange problem with my GUI method and maybe someone has an idea to solve it. This problem arises when I get a value on an RPC mehtode.
... public class Main: Photon.MonoBehaviour .......
dmgAmount int = 5;
void SendHit (PhotoPlayer target) {
photonView.RPC ("DamageRPC", target dmgAmount);

DamageRPC void (int dmg) {
Damage (dmg);
void Damage (int dmg) {

healthScript.SetHealth (dmg);


so far ...
health within the script:
public class health script: {Photon.MonoBehaviour
internal void SetHealth (int dmg) {
if (curHealth> 0) {
curHealth -= dmg;
Debug.log (curHealth);
Debug.log (dmg);
curHealth Mathf.Clamp = (curHealth, 0, MaxHealth);

OnGUI void () {/ / / debug gui ...
if (photonView.isMine) {
GUILayout.BeginArea (new Rect (200, 50, 200, 500));
GUILayout.BeginVertical ();
GUILayout.BeginHorizontal ();
GUILayout.Label ("CurHealth" curHealth.ToString ());
                                       if (GUILayout.Button ("reduce health")) {/ / / debug test button ...
SetHealth (5);
                                                                 main.UPDATE_DB ();
GUILayout.EndHorizontal ();

GUILayout.EndVertical ();
GUILayout.EndArea ();
The debug log in SetHealth returns the correct dmg, which was transmitted by the RPC to the target, also agrees curHealth ... well, ok.
However, the gui does nothing. it is not responding.
the curHealth is always transferred into a db, after restarting the game the correct curHealth (which was reduced by the RPC) is displayed ...

However, when I call this method with the button - it works. the curHealth is shown by the GUI correctly .

i hope someone can give me a clue, thanks in advance:)


  • After looking at the chat script of the network plugin, i realized that i have to use a static ... well, why? what is the difference between using the button to apply the dmg or the RPC ? both send an integer - SetHealth(dmg) - ... this is a little bit confusing to me
  • However, it´s solved. :roll: