playMaker

Author Topic: Error while DebugLogging  (Read 1845 times)

Mayhem

  • Full Member
  • ***
  • Posts: 171
Error while DebugLogging
« on: May 10, 2013, 06:25:18 AM »
Hey there.

I have some nGUI Buttons which have the UIEventsToPlayMaker Script attached.

They also have this Script attached:

Code: [Select]
    using UnityEngine;
    using System.Collections;
     
    public class NGUIButton : MonoBehaviour
    {
        public ButtonType type;
        public NGUIInput input;

        public PlayMakerFSM targetFSM;


void OnEnable()
{
if (targetFSM == null)
{
targetFSM = GetComponent<PlayMakerFSM>();
}

if (targetFSM == null)
{
enabled = false;
}
}



       
        public void OnPress(bool pressed) {
            if (pressed) {
                switch (type) {
                    case ButtonType.LEFT :  input.SetX(-1f);
targetFSM.Fsm.Event("LEFT");
break;
               
case ButtonType.RIGHT : input.SetX(1f);
targetFSM.Fsm.Event("RIGHT");

break;
                   
case ButtonType.ATTACK : input.SetX(0f);
targetFSM.Fsm.Event("ATTACK");


break;
                   
case ButtonType.JUMP :  input.Jump(true);
targetFSM.Fsm.Event("JUMP");

break;
                }
            } else {
                switch (type) {
                    case ButtonType.LEFT :  input.SetX(0.0f); break;
                    case ButtonType.RIGHT : input.SetX(0.0f); break;
                    case ButtonType.ATTACK :  input.SetY(0.0f); break;
                    case ButtonType.JUMP :  input.Jump(false); break;
                }
            }
        }
    }
     
    public enum ButtonType { LEFT, RIGHT, JUMP, ATTACK };


In order to test if this works I'm sending some events here as you see like "LEFT", "RIGHT", "ATTACK" and "JUMP". These Events are Global Transitions in the FSM of the Buttons and everything works fine, it's working.

The States of the FSM have all just one Action:

DebugLog - The just print a certain Text like "RightButton was pressed" "LeftButton was pressed" etc.
But as soon as I stop the game after looking the the Playmaker-DebugLogger, I get this error:

Quote
NullReferenceException: Object reference not set to an instance of an object
HutongGames.PlayMakerEditor.FsmLogger.DoLogView ()
HutongGames.PlayMakerEditor.FsmLogger.OnGUI ()
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture)


Log in file: at line: -1

It's nothing dramatical, and it doesn't crash the game or whatever, but I would like to now what's going on, since it's happening AFTER stopping the game.
« Last Edit: May 10, 2013, 06:31:49 AM by Mayhem »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Error while DebugLogging
« Reply #1 on: May 11, 2013, 08:39:36 AM »
Hi,

 Can you report this using the playmaker bug report ( in the playmaker/tool/ menu), then it will be tracked properly.

thanks,

 Jean