playMaker

Author Topic: Creating and Deleting Objects  (Read 3887 times)

holyjewsus

  • Playmaker Newbie
  • *
  • Posts: 6
Creating and Deleting Objects
« on: April 17, 2011, 04:10:14 AM »
I want to create a slider (done)

when the slider goes up I want to create a series of trees (done)

When I move the slider down I want to destroy those tree objects(???)

I'm using a find closest gameobject action with my spawn object as the object to look near, storing this in a variable and then a destroy game object action on that stored variable... the actions fire correctly but nothing happens to my trees.

also sometimes I get an error in the console, no transition to kill state(my destroy state) seems like the find closest action isn't storing anything.

any clues or better way to do this?

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3987
  • Official Playmaker Support
    • LinkedIn
Re: Creating and Deleting Objects
« Reply #1 on: April 17, 2011, 10:37:18 AM »
I would parent the created trees to the spawn point, then use Get Child Count and Get Child Index to destroy the trees as the slider goes down - essentially using the scene hierarchy as an array...

Not sure why find closest wouldn't work, but this sounds like a good screencast/sample so maybe I'll give it a go myself...

holyjewsus

  • Playmaker Newbie
  • *
  • Posts: 6
Re: Creating and Deleting Objects
« Reply #2 on: April 17, 2011, 03:38:52 PM »
I feel foolish but where is child index?

holyjewsus

  • Playmaker Newbie
  • *
  • Posts: 6
Re: Creating and Deleting Objects
« Reply #3 on: April 17, 2011, 03:39:46 PM »
OH, get child num?

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3987
  • Official Playmaker Support
    • LinkedIn
Re: Creating and Deleting Objects
« Reply #4 on: April 17, 2011, 05:09:57 PM »
Yes - sorry!