playMaker

Author Topic: [SOLVED] Get multiple components of the same name from a game object  (Read 2015 times)

Fat Pug Studio

  • Beta Group
  • Hero Member
  • *
  • Posts: 1294
    • Fat Pug Studio
Hello,

i'd really like to avoid dragging and dropping components and using set property to tweak components, and get component will probably get only the first component on the game object when i fire it multiple times. Script way would be to add them to array. What would be the Playmaker way?
« Last Edit: December 05, 2020, 01:23:44 PM by krmko »
Available for Playmaker work

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Get multiple components of the same name from a game object
« Reply #1 on: December 02, 2020, 06:04:26 PM »
Hi.
Maybe add to an Array List and get the list?

Fat Pug Studio

  • Beta Group
  • Hero Member
  • *
  • Posts: 1294
    • Fat Pug Studio
Re: Get multiple components of the same name from a game object
« Reply #2 on: December 02, 2020, 06:23:53 PM »
Yeah, but how will i get them both? When i run get component i will always get the first one.
Available for Playmaker work

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Get multiple components of the same name from a game object
« Reply #3 on: December 03, 2020, 08:12:06 AM »
Hi.
What i mean was you could set a array list component on target object and place the component manually. and then get the list in game mode.

But i made a Array version to get components (see Attachment below)

Let me know if it worked.

Fat Pug Studio

  • Beta Group
  • Hero Member
  • *
  • Posts: 1294
    • Fat Pug Studio
Re: Get multiple components of the same name from a game object
« Reply #4 on: December 05, 2020, 01:23:23 PM »
I wasn't aware there was a GetComponents method in Unity :-[

Works like a charm, thanks!
Available for Playmaker work