playMaker

Author Topic: issue with everyframe  (Read 628 times)

cel

  • Full Member
  • ***
  • Posts: 132
issue with everyframe
« on: April 18, 2022, 04:07:27 PM »
Hi,

I have a custom action that its meant to throw errors and stop the flow of playmaker when certain conditions arise.
The problem is that if everyframe is not checked the error only is passed to the console and playmaker keeps working.

But if everyframe is checked playmaker stops and the error shows in the playmaker state editor along with showing in the console, this is the behaviour I want.


Code: [Select]
using UnityEngine;

namespace HutongGames.PlayMaker.Actions
{

[ActionCategory("Gamecreator Variables")]
public class testt : FsmStateAction
{
[Tooltip("Copy the variable every frame - MIGHT AFFECT PERFORMANCE")]
public bool EveryFrame;
// Code that runs on entering the state.
public override void OnEnter()
{
getVar();
if (!EveryFrame)
{

Finish();
}
}

// Code that runs every frame.
public override void OnUpdate()
{
getVar();
}

public void getVar()
{

LogError("error");
}


}

}

any idea on how to make it work when everyframe is not checked?

Thanks in advance

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7625
    • jinxtergames
Re: issue with everyframe
« Reply #1 on: April 18, 2022, 05:21:58 PM »
Hi.
You can use Debug.LogError()

Sample : (it will show the fsm name, state the action is in and the gameobject name + you can click on it and it should highlight the object)
Code: [Select]
       Debug.LogError("Error Text" + Fsm.GameObjectName + " / FSM :" + Fsm.Name + " / State : " + Fsm.ActiveStateName, Fsm.GameObject);

cel

  • Full Member
  • ***
  • Posts: 132
Re: issue with everyframe
« Reply #2 on: April 19, 2022, 08:37:37 AM »
@djaydino

Didn't work, same behaviour has before...

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7625
    • jinxtergames
Re: issue with everyframe
« Reply #3 on: April 19, 2022, 09:51:12 AM »
Hi.
On Console, is Error Pause Enabled.
i have been testing and i get this behavior when Error Pause is off, else it will pause.

Tested with latest PM and unity 2021.2.5f1

cel

  • Full Member
  • ***
  • Posts: 132
Re: issue with everyframe
« Reply #4 on: April 19, 2022, 10:14:32 AM »
@ djaydino

have tried that before... but the everyframe issue happens with the error pause turned off... with everyframe on I get playmaker to stop and show the error in the state window and the console and the flowchart window is outline red... when everyframe is off playmaker keeps going (the flowchart window is outlined green) but i get the error in the console...

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7625
    • jinxtergames
Re: issue with everyframe
« Reply #5 on: April 19, 2022, 12:14:42 PM »
Hi.
Strange, on my end its stopping.

It does not stop if on the Console Window the Error Pause is off and Every frame disabled on the action.

And if Every Frame is on it will stop no matter if Error Pause is on or off.

cel

  • Full Member
  • ***
  • Posts: 132
Re: issue with everyframe
« Reply #6 on: April 19, 2022, 02:44:38 PM »
true.... but if everyframe is on (or on update) there is no need to have the console on error pause on, it stops playmaker dead on with a warning on the action that causes the error... but this doesn't happen if everyframe is off (on start)