playMaker

Author Topic: Deriving Classes From PlayMakerFSM ---- Overriding Awake Not Possible?  (Read 1770 times)

WallarooMonkey

  • Playmaker Newbie
  • *
  • Posts: 5
Hi guys,

PlayMaker 1.7.7.f6
Unity 3.5.7.f6

I've got a class I derive from PlayMakerFSM.  I also have some code I want to run in the Awake() method.  Unfortunately PlayMakerFSM's Awake() doesn't seem to be public or virtual.  :(  This really prevents me from having my own Awake() method with my own code.

Anyone else run into this?  Anyone got any advice?

Thanks!
Michael

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3987
  • Official Playmaker Support
    • LinkedIn
Re: Deriving Classes From PlayMakerFSM ---- Overriding Awake Not Possible?
« Reply #1 on: February 10, 2014, 04:08:39 PM »
I could make Awake protected virtual in the next update... but I'm curious about your use case. Why derive from PlayMakerFSM instead of referencing it in your components?

WallarooMonkey

  • Playmaker Newbie
  • *
  • Posts: 5
Re: Deriving Classes From PlayMakerFSM ---- Overriding Awake Not Possible?
« Reply #2 on: February 10, 2014, 05:49:20 PM »
I think it's just how the code got written when we were using PlayMaker 1.4.2f1.  We derive from PlayMakerFSM to create our own FSM that ties into our game code's message passing system.  It could be solved with a refactor, I'm sure.

I decided to update to the newest PlayMaker version and ran into this issue while porting.

Is it recommended we should not derive from PlayMakerFSM?  If so should the class be sealed to reflect this?

Thanks for the fast response!
Michael

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3987
  • Official Playmaker Support
    • LinkedIn
Re: Deriving Classes From PlayMakerFSM ---- Overriding Awake Not Possible?
« Reply #3 on: February 10, 2014, 06:42:52 PM »
I'll play around with it here and see if it's a can of worms... I'm kind of curious how the Unity editor handles the derived class, e.g., do the custom editors/inspectors for PlayMakerFSM still work? What's been your experience?

WallarooMonkey

  • Playmaker Newbie
  • *
  • Posts: 5
Re: Deriving Classes From PlayMakerFSM ---- Overriding Awake Not Possible?
« Reply #4 on: February 10, 2014, 07:01:19 PM »
Yup, it's worked pretty well for us at 1.4.2.f1.  I haven't noticed any problems of our derived classes vs using PlayMakerFSM on its own.

Thanks for taking a look!