playMaker

Author Topic: Arraymaker: Destroy All  (Read 1231 times)

Broken Stylus

  • Beta Group
  • Hero Member
  • *
  • Posts: 772
Arraymaker: Destroy All
« on: November 22, 2021, 12:45:47 PM »
Deletes all proxies on a given game object; by default, the owner.
For both Array Lists and Hash Tables.

Fat Pug Studio

  • Beta Group
  • Hero Member
  • *
  • Posts: 1294
    • Fat Pug Studio
Re: Arraymaker: Destroy All
« Reply #1 on: November 24, 2021, 11:28:23 AM »
For each loop with GetComponent and destroy? I can write it out if you want.
Available for Playmaker work

Broken Stylus

  • Beta Group
  • Hero Member
  • *
  • Posts: 772
Re: Arraymaker: Destroy All
« Reply #2 on: November 24, 2021, 04:46:35 PM »
Hey, thanks. I'm no need of this but I figured out that I may not be the only one sticking more than one proxy on a GO and thought it might be a good thing to have a straight way to realize a complete purge.
It seemed tricky though because of the way Unity and Playmaker combine since Unity is built with the idea of using only one instance of a given component, at least a native one, and it shows when referencing FSMs from within a FSM. I wasn't even sure that an action would be able to properly parse all FSMs on a GO without knowing their names, where in fact one would need a way to access Unity's own "secret" way of listing components.
But then I still looked into the actions that target a specific proxy and saw that they, in fact, already rely on an array by getting all components of <type> but specifically avoid all proxies that don't have a name matching the reference. :-)
So maybe the Destroy ... actions could have a special mode where if the reference is empty ("leave empty to remove all <type> proxies" kind of stuff), it will simply destroy all proxies of that type.

Fat Pug Studio

  • Beta Group
  • Hero Member
  • *
  • Posts: 1294
    • Fat Pug Studio
Re: Arraymaker: Destroy All
« Reply #3 on: November 24, 2021, 11:26:16 PM »
Yeah i stick a lot of proxies to a GO too (mostly for managers of sorts), but i seldom have the need to do it on runtime. But it's not a problem to remove all components of the same type from GO, bigger problem would be to remove SOME components of the same type.
Available for Playmaker work