playMaker

Author Topic: Runs OnExit on FsmStateAction without running onEnter : 1.6.1.f4  (Read 2619 times)

Jimmy

  • Playmaker Newbie
  • *
  • Posts: 1
At FSM startup if the start state (FirstState) sends a event to itself that makes it change state the following FsmStateActions in the FirstState will run OnExit without having run onEnter. Feels a bit strange and i think it might be a bug :).

Example:
1 Create empty scene.
2 Create Gameobject and add FSM to it.
3 Create a State 2 in the FSM.
4 Add DoIt event to State 1 and link it to State 2
5 Create a new FsmStateAction with the name IAmANode .

Code: [Select]
using UnityEngine;

namespace HutongGames.PlayMaker.Actions
{
[ActionCategory(ActionCategory.Debug)]
public class IAmANode : FsmStateAction
{
public override void OnEnter()
{
Debug.Log("IAmANode Enter\n");
}

public override void OnExit()
{
Debug.Log("IAmANode Exit\n");
}
}
}

6 Add IAmANode to State 1 in the Action browser.
7 Add a SendEvent to State 1 and select the DoIt event.
8 Play the scene and it will say in console that it enters and exits the IAmANode.
9 Stop project and move IAmANode to be after SendEvent in the action list.
10 Play the project. Now only IAmANode Exit will be printed.

If it have not run OnEnter it should not run OnExit on the FsmStateAction. If this is the intended behavior please explain why so i can learn something new :).

I'm running Playmaker 1.6.1.f4 with Unity 4.2.0f4.

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 4000
  • Official Playmaker Support
    • LinkedIn
Re: Runs OnExit on FsmStateAction without running onEnter : 1.6.1.f4
« Reply #1 on: August 21, 2013, 11:33:52 AM »
It sounds like a bug - I'll look into it...