Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: WallarooMonkey on February 10, 2014, 03:28:50 PM

Title: Deriving Classes From PlayMakerFSM ---- Overriding Awake Not Possible?
Post by: WallarooMonkey on February 10, 2014, 03:28:50 PM
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
Title: Re: Deriving Classes From PlayMakerFSM ---- Overriding Awake Not Possible?
Post by: Alex Chouls 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?
Title: Re: Deriving Classes From PlayMakerFSM ---- Overriding Awake Not Possible?
Post by: WallarooMonkey 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
Title: Re: Deriving Classes From PlayMakerFSM ---- Overriding Awake Not Possible?
Post by: Alex Chouls 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?
Title: Re: Deriving Classes From PlayMakerFSM ---- Overriding Awake Not Possible?
Post by: WallarooMonkey 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!