playMaker

Author Topic: get Component in children issue  (Read 2147 times)

hx

  • Playmaker Newbie
  • *
  • Posts: 13
get Component in children issue
« on: December 20, 2017, 10:04:48 AM »
Hello,
i have added this script from ecosystem. and want to use it for a big group of gameobjects. the goal is to get all the mesh renderer component of that group, and make some changement. sofar i have always the problem, that only one component is stored in the valiable. the valiable i set to object, like the in the screenshot. but since its just object, then its only one in the valiable. when i set it to array or string, then it doesnt show in the component valiable option anymore.
any advice?
thank you in advance.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: get Component in children issue
« Reply #1 on: December 20, 2017, 06:48:18 PM »
Hi.
The action only gets the component once.

You can make a loop by using 'get next child'
On the next state (connected to loop event) use get component
then do what you need to do to the component and then transition back to the state with the 'get next child' in it.
Then connect a state to the Finished Event, to continue after all the children are done.

hx

  • Playmaker Newbie
  • *
  • Posts: 13
Re: get Component in children issue
« Reply #2 on: February 07, 2018, 06:30:20 AM »
Hi.
The action only gets the component once.

You can make a loop by using 'get next child'
On the next state (connected to loop event) use get component
then do what you need to do to the component and then transition back to the state with the 'get next child' in it.
Then connect a state to the Finished Event, to continue after all the children are done.

thank you very much for your reply! i have tried that, but there is alway kind of "delay" in the action. for example if i want to change the color of 10 objects using this action, then there is some faster some slower. looks quite werid. any other suggestion?

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: get Component in children issue
« Reply #3 on: February 07, 2018, 06:06:11 PM »
Hi,
Can you show some images or video of what you are doing?

Are the objects prefabs?
What are you doing with the components?

hx

  • Playmaker Newbie
  • *
  • Posts: 13
Re: get Component in children issue
« Reply #4 on: February 09, 2018, 09:47:31 AM »
hello,

sorry that i dont have screenshot. but i can discribe the use case for you. i have a object which has 100 different parts. the goal is to change the object into another material. i would definetly not give every mesh renderer of the part a script to change the material. so i would colllect all these parts in an array and make the loop (get next child) to change the whole object material. but then it has delay in case of performance during the time it loops, which looks not good, the material of the parts change one after one..
i hope i made it clear. this is always the issue with such objects which has a lot of parts. hope you guys give a better solution.

thanks!