Does your version work for you?
I'd go about it more like this
using UnityEngine;
namespace HutongGames.PlayMaker.Actions
{
[ActionCategory(ActionCategory.GameObject)]
[HutongGames.PlayMaker.Tooltip("Activates/deactivates a Game Object. Use this to hide/show areas, or enable/disable many Behaviours at once.")]
public class ToggleGameObject : FsmStateAction
{
[RequiredField]
[UnityEngine.Tooltip("The GameObject to toggle.")]
public FsmOwnerDefault gameObject;
public bool resetOnExit;
public override void Reset()
{
gameObject = null;
resetOnExit = true;
}
public override void OnEnter()
{
DoActivateGameObject();
Finish();
}
public override void OnExit()
{
if(resetOnExit==true){
DoActivateGameObject();
}
}
void DoActivateGameObject()
{
var go = Fsm.GetOwnerDefaultTarget(gameObject);
if (go == null)
{
return;
}
if (go.activeSelf)
go.SetActive(false);
else
go.SetActive(true);
}
}
}