playMaker

Author Topic: FSM goes through states it isn't intended to [KINDA SOLVED]  (Read 2103 times)

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 14684
  • Official Playmaker Support
    • View Profile
Re: FSM goes through states it isn't intended to
« Reply #15 on: February 22, 2018, 03:51:28 AM »
Hi,

I am suspecting that the issue could be that you manually enable and disable component, and I don't think you should do that, the pooling system already deactivate the GameObject for you. I think these extra steps could be the reson of this issue ( which should not happen, but while this is studied and reproed on a simpler system, you need to progress in your game).

 so I suggest you don't manually disable enable component. Have you tried that already? When I deal with Prefabs with PlayMaker in a Pool, I always take this into account and manually reset all variables on tghe Start State, or do nothing until I get a event "INIT" that I fire from a manager that knows this instances ( the fsm that spawned it for example). Since I always do that, I never encountered this issue you are having, so maybe you could try on that prefab, starting with doing a proper reset of variables on start ( Reset on Disable, doesn't reset variables from my experience, try on a simple Fsm with an int counter, the int variable will not be set back to the default value on disable/enable).

I'll raise the case to Alex and see what he has to say about this, maybe there is something to do or to adress indeed.

Bye,

 Jean

krmko

  • Beta Group
  • Hero Member
  • *
  • Posts: 997
    • View Profile
    • Fat Pug Studio
Re: FSM goes through states it isn't intended to
« Reply #16 on: February 22, 2018, 04:02:00 AM »
Hi Jean, actually i didn't manualy enable/disable components until the problem arose, that is the thing i tried in the efforts to try to reset the variables. That is the root of the problem, i see this guy also had troubles with this:

http://hutonggames.com/playmakerforum/index.php?topic=8080.0

I though reset on disable resets variable values too, and it's only logical it should, manually reverting all the local variables to blank state is nonsense, it would be good if there was an option per fsm to reset all variables upon disabling it.

But, the question still remains why the FSM shows the state has already been through if it has been reset on disabled? Is it wanted behaviour or the thing wasn't designed with pooling in mind, only classic instancing?
« Last Edit: February 22, 2018, 04:19:41 AM by krmko »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 14684
  • Official Playmaker Support
    • View Profile
Re: FSM goes through states it isn't intended to [KINDA SOLVED]
« Reply #17 on: February 25, 2018, 11:53:48 PM »
Hi,

 First thing is that you have two conflicting features, the pooling system deactivate the gameobject, thus also disabling the component, and on top of that you also manually disable/enable components. I would let go on this and rely on the pooling system to activate deactivate things. This could be where PlayMaker gets confused.

I'll raise the case to Alex as to why variables are not resetted, I would also expected variables to be resetted. but I never use this feature actually. I always resort to a manual init call when I have a pool or similar feature, It alwasy gives me a lot more contorl in the end.

You are right the question remains as to why the fsm gets confused.

 Before I can submit this as a ticket, it would be good that we could extract this issue with a minimal repro case.

Bye,

 Jean