playMaker

Author Topic: clone object then stop, disable, or destroy FSMs[SOLVED]  (Read 1014 times)

abend

  • Playmaker Newbie
  • *
  • Posts: 36
    • View Profile
clone object then stop, disable, or destroy FSMs[SOLVED]
« on: October 24, 2019, 11:50:42 AM »
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?
« Last Edit: October 25, 2019, 06:13:56 AM by djaydino »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 5184
    • View Profile
    • jinxtergames
Re: clone object then stop, disable, or destroy FSMs
« Reply #1 on: October 24, 2019, 02: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 :


abend

  • Playmaker Newbie
  • *
  • Posts: 36
    • View Profile
Re: clone object then stop, disable, or destroy FSMs
« Reply #2 on: October 24, 2019, 05: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.

wetcircuit

  • Junior Playmaker
  • **
  • Posts: 72
    • View Profile
    • wetcircuit.com
Re: clone object then stop, disable, or destroy FSMs
« Reply #3 on: October 24, 2019, 08:25:39 PM »
Can you remove the FSMs as components?

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 5184
    • View Profile
    • jinxtergames
Re: clone object then stop, disable, or destroy FSMs
« Reply #4 on: October 25, 2019, 06: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.