playMaker

Author Topic: Custom class variables reset  (Read 2895 times)

jakeslack27

  • Playmaker Newbie
  • *
  • Posts: 11
Custom class variables reset
« on: January 09, 2014, 05:10:12 AM »
Hi,

So Playmaker doesn't seem to persist an object of a custom class!?

I have a custom action called UpdateState:

Code: [Select]
[System.Serializable]
public class PEChangeState
{
    public string name;
    public bool change;
    public bool active;
}

namespace HutongGames.PlayMaker.Actions
{
[ActionCategory(ActionCategory.Animation)]
[Tooltip("")]
public class PEUpdateState : FsmStateAction
{
[RequiredField]
[Tooltip("Key asset to update states for")]
public PEKeyAsset keyAsset = null;

                public PEChangeState newState = new PEChangeState();
        }
}

I then have a Custom Action Editor, 'ChangeStateEditor', that creates a PEChangeState and displays it in the inspector.  The variables exposed (name, change, active) can then be set.  However, the state of these variables do not persist between game plays or even editor window close/open (it looks like the newState object is being cleared).  It only seems that built-in classes are persisted?

Am I missing something here?  Also, newState will eventually become a List of PEChangeStates.  Will other problems arise from this?

Thanks, Jake

« Last Edit: January 09, 2014, 10:19:14 AM by jakeslack27 »

jakeslack27

  • Playmaker Newbie
  • *
  • Posts: 11
Re: Custom class variables reset
« Reply #1 on: January 10, 2014, 05:47:43 AM »
Continue to remain stuck with this one.  Some help would really be appreciated!

Jake

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Custom class variables reset
« Reply #2 on: January 10, 2014, 06:04:50 AM »
Hi,

 Get back to me early next week ok? and I'll run some tests, I have to catch with a lot of pending threads and tasks first :)

bye,

 Jean

jakeslack27

  • Playmaker Newbie
  • *
  • Posts: 11
Re: Custom class variables reset
« Reply #3 on: January 10, 2014, 06:57:56 AM »
Ok no problem.  Thanks Jean.

jakeslack27

  • Playmaker Newbie
  • *
  • Posts: 11
Re: Custom class variables reset
« Reply #4 on: January 16, 2014, 06:20:57 AM »
Hi, still having this same issue.  Please could someone shed some light on this issue as it's preventing me from moving forward.  Do I need to write my own persistence manager?

jakeslack27

  • Playmaker Newbie
  • *
  • Posts: 11
Re: Custom class variables reset
« Reply #5 on: January 19, 2014, 11:01:16 AM »
Unfortunately going to have to bump this. Is more info required?

jakeslack27

  • Playmaker Newbie
  • *
  • Posts: 11
Re: Custom class variables reset
« Reply #6 on: January 22, 2014, 05:12:27 AM »
A second bump and a personal request to Jean. Would really like some help here, deadlines are  fast approaching and haven't made any progress.

Thanks, Jake

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Custom class variables reset
« Reply #7 on: January 22, 2014, 07:12:06 AM »
Hi,

 Everything works ok here. I double checked.

 Don't put the attribute [System.Serializable], it works without it.

in your action, you should only create a new instance of your class in the "Reset()" function, not in the public declaration.

Bye,

 Jean

jakeslack27

  • Playmaker Newbie
  • *
  • Posts: 11
Re: Custom class variables reset
« Reply #8 on: January 29, 2014, 08:35:47 AM »
OK I got it working, but as soon as I turn the newState into a List it again breaks.  Are lists not persisted?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Custom class variables reset
« Reply #9 on: January 30, 2014, 05:03:24 AM »
Hi,

 can you provide the code you use? I am not sure what you are trying to achieve here.

bye,

 Jean