playMaker

Author Topic: Maybe a bug in new Playmaker with Unity4  (Read 2986 times)

roronoazaoxl

  • Playmaker Newbie
  • *
  • Posts: 4
Maybe a bug in new Playmaker with Unity4
« on: December 03, 2012, 06:55:16 AM »
I have an aciton which has an FsmFloat member variable.

I used to assign this variable in it's declaration like this:

Public FsmFloat volum = 1f;

It works until I upgrade my game to Unity4.

I got lots of error in debug console like this:

Error loading action: Playbgmusic : FSM : trigger : PlayBackGroundMusic : volume
UnityEngine.Debug:Internal_Log(Int32, String, Object)
UnityEngine.Debug:LogError(Object)
HutongGames.PlayMaker.ActionData:CreateAction(FsmState, Int32)
HutongGames.PlayMaker.ActionData:LoadActions(FsmState)
HutongGames.PlayMaker.FsmState:LoadActions()
HutongGames.PlayMaker.Fsm:InitData()
HutongGames.PlayMaker.Fsm:Init(MonoBehaviour)
PlayMakerFSM:Awake()

Then I move the assigment to Reset() Method like this:

    public FsmFloat volume;

    public override void Reset()
    {
        volume = 1f;
    }

But I still get this error after I build my game( this error never happen when I execute in editor

mode).

This problem make my game crash a lot. Is anyone have idea that happen here.

Thanks!

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 4000
  • Official Playmaker Support
    • LinkedIn
Re: Maybe a bug in new Playmaker with Unity4
« Reply #1 on: December 03, 2012, 10:26:25 AM »
Can you email me the action? I'll take a look at it...

roronoazaoxl

  • Playmaker Newbie
  • *
  • Posts: 4
Re: Maybe a bug in new Playmaker with Unity4
« Reply #2 on: December 03, 2012, 11:30:36 PM »
This is the action code:

[ActionCategory("Music")]
[Tooltip("PlayBackGroundMusic")]
public class PlayBackGroundMusic : FsmStateAction
{
    public FsmFloat volume;
    public AudioClip clip_in;
    public AudioClip clip_loop;
   // Code that runs on entering the state.

    public override void Reset()
    {
        volume = 1f;
    }

   public override void OnEnter()
   {
      GameHandler.Instance.backGroundMusicIn.clip = clip_in;
       GameHandler.Instance.backGroundMusicLoop.clip = clip_loop;
        GameHandler.Instance.backGroundMusic.GetComponent<PlayMakerFSM>().FsmVariables.GetFsmFloat("volumeIn").Value = volume.Value;
       GameHandler.Instance.backGroundMusic.GetComponent<PlayMakerFSM>().SendEvent("PlayIn");

   }
}

Actually there are three other action have this problem:

ScaleTime will throw out this error:
Error loading action: UICamare: FSM : trigger : ScaleTime : adjustFixedDeltaTime

An Revised vesion of DestroySelf:

   public class DestroySelf : FsmStateAction
   {
      [Tooltip("Detach children before destroying the Owner.")]
      public FsmBool detachChildren;
      public FsmBool putBackToPool;
      public FsmBool activate;

      public override void Reset()
      {
         detachChildren = false;
         putBackToPool = false;
         activate = false;
      }

      public override void OnEnter()
      {
         if (Owner != null)
         {
            if (detachChildren.Value)
            {
               Owner.transform.DetachChildren();
            }
            
            if ( !putBackToPool.Value )
            {
               Object.Destroy(Owner);
            }
            else
            {
               if ( ResourceManager.Instance.poolManager != null && ResourceManager.Instance.CheckPool(Owner.name) )
               {
                  ResourceManager.Instance.ReturnResource(Owner, Owner.name, activate.Value);
               }
               else
               {                  
                  Debug.LogError("No Spawn Pool for " + Owner.name + " in Scene");
                  Object.Destroy(Owner);
               }
            }
         }
         
         Finish();
      }
   }

this one will throw two errors:
Error loading action: Lighting_01 : FSM : State 1 : HutongGames.PlayMaker.Actions.DestroySelf : putBackToPool
Error loading action: Lighting_01 : FSM : State 1 : HutongGames.PlayMaker.Actions.DestroySelf : activate

There is another one:
public class ChangeGameState : FsmStateAction
{
    public GameState gameState;
    public FsmBool openEventUI;
   // Code that runs on entering the state.
      
    public override void Reset()
    {
        openEventUI = true;
    }
   
   public override void OnEnter()
   {
        GameMain.Instance.gameState = gameState;
        if (GameMain.Instance.UI != null)
        {
           if (GameMain.Instance.UI.eventWindow != null)
           {
              GameMain.Instance.UI.eventWindow.showEventWindow = openEventUI.Value;
           }
        }
      Finish();
   }
}

the error is:
Error loading action: DeadLine : FSM : unlock : ChangeGameState : openEventUI

I assigned a default value for those error variables at decleration. I change all tha assignment to Reset(), but it doesn't work.