playMaker

Author Topic: Crash when clicking on custom action in the action browser.  (Read 2509 times)

Disastercake

  • Full Member
  • ***
  • Posts: 101
  • www.disastercake.com
    • Disastercake
This code is crashing Unity jsut by cimply clicking on the action in the action browser.  Any idea why?

Code: [Select]
using System;
using System.Collections;
using UnityEngine;

namespace HutongGames.PlayMaker.Actions{

[ActionCategory("Soul Saga")]
[Tooltip("")]
public class GetLocalPlayerId : FsmStateAction
{
//Public
[RequiredField]
public FsmGameObject VarManager;
[RequiredField]
[UIHint(UIHint.Variable)]
public FsmInt storeID;
public bool everyFrame;

GlobalVariableManager GVM;

public override void Reset()
{
storeID.Value = 0;
everyFrame = false;
}

public override void OnEnter()
{
DoGetId();

if (!everyFrame)
Finish();
}

public override void OnUpdate()
{
DoGetId();
}

void DoGetId()
{
if (storeID.Value == 0) return;
GVM = VarManager.Value.GetComponent<GlobalVariableManager>();

storeID.Value = GVM.localPlayerId;
}
}

}
Soul Saga - Anime themed adventure RPG by Disastercake

http://www.disastercake.com

Disastercake

  • Full Member
  • ***
  • Posts: 101
  • www.disastercake.com
    • Disastercake
Re: Crash when clicking on custom action in the action browser.
« Reply #1 on: May 22, 2012, 07:00:55 PM »
It looks like setting the value of the FsmInt in Reset() is crashing it.  Can anyone explain why?
Soul Saga - Anime themed adventure RPG by Disastercake

http://www.disastercake.com

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 4000
  • Official Playmaker Support
    • LinkedIn
Re: Crash when clicking on custom action in the action browser.
« Reply #2 on: May 22, 2012, 07:58:36 PM »
Not sure, will look into it. In the meantime change it to:

storeID = 0;

That is a shortcut that creates a new FsmFloat and sets it to 0, and is normally used in Reset().