playMaker

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

...

  • Beta Group
  • Hero Member
  • *
  • Posts: 1294
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 »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7618
    • 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?

...

  • Beta Group
  • Hero Member
  • *
  • Posts: 1294
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.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7618
    • 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.

...

  • Beta Group
  • Hero Member
  • *
  • Posts: 1294
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!