Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: abend on October 24, 2019, 02:50:42 PM

Title: clone object then stop, disable, or destroy FSMs[SOLVED]
Post by: abend on October 24, 2019, 02:50:42 PM
I have an object that gets a few children added at runtime. after the object finishes with all of it's setup FSMs, child FSMs, and templates also added at runtime, I make a clone of it. I want to strip out all of the FSMs from the clone before they have a chance to fire off. I just want like a little dummy version of my complicated thing.

I have tried to update a FSM template to destroy the Play Maker FSM Component as the last state, but it does not work.

Any ideas on how I can kill these things once I instance a new one?
Title: Re: clone object then stop, disable, or destroy FSMs
Post by: djaydino on October 24, 2019, 05:16:18 PM
Hi.
Start will start doing something the moment its active.

what you can do is use some events @ start.

Make a new state and place start to that state.
Then add a transition and call it 'Activate' for example.
The 1st time you need to Send Event By Name (Activate) from a different object (manager)
so that the fsm runs.
Then when you cloned and not sending the 'Activate' event, the fsm will stay on the start state.

As long as you did not send the event to it.

This video might be helpful :

Title: Re: clone object then stop, disable, or destroy FSMs
Post by: abend on October 24, 2019, 08:04:57 PM
Thanks DJ!

I ended up using the object name, since unity appends (Clone) to the name, I was able to test for the string in the name and then prevent it from firing. I appreciate the concept! Sometimes I find I'm trying to approach it the hard way. I was surprised that I could not find actions that would remove an FSM though, I would have thought that would be a normal function.
Title: Re: clone object then stop, disable, or destroy FSMs
Post by: wetcircuit on October 24, 2019, 11:25:39 PM
Can you remove the FSMs as components?
Title: Re: clone object then stop, disable, or destroy FSMs
Post by: djaydino on October 25, 2019, 09:13:27 AM
Hi.
Yes you can, same as other components.

You can use 'Destroy Component'

its not really a common thing to remove fsm or scripts tho.