Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: ttham on February 03, 2017, 11:10:05 PM
-
Hi.I have array of lights I need to apply one color to all of them with "Color interpolate" but if i'm using "Array get next" action, its working one by one,how to do it simultaneously? Tank you!
-
I guess i need something like "foreach" but i can't find any action like that.
-
What about use a FSM template with everything you need and use the template on each light.
That way i believe you can change the "main" template and every light will react to that at the same time. I think templates are instances but I do not know the behavior at runtime
-
Yea i saw that action, but a was afraid that this is gonna be bad for performance.
But if there is no other way i have no choiŃe. Thank you.
-
You can use the array get next to perform actions for each object in array. Templates can work like methods. You can pass data to it and perform actions involving that data and then return events with data. So you can pass a light game object to a template then perform actions on it and then send event or just finish fsm.
-
Ok I'm trying this http://prntscr.com/e50atk (http://prntscr.com/e50atk)
This what i have on a light object.http://prntscr.com/e50b31 (http://prntscr.com/e50b31)
"Light" is global variable.and it's not working.
If i set it on self its just change color on game start.
I can use global transition of variables to activate template, but it will affect all lights in scene not only those that i picked in current array.
-
Ok its working now, but it still goes one by one. Even with that for each action.
-
Hi,
Don't worry with iterations and loop in this sort of features, it's fine. Be aware that even if a custom action was made, it would still need to iterate trhough that list anyway, so actually makes no difference, the slight overhead of doing it manually is totally insignificant compared to what could go wrong with shaders, visual effects, meshs in your scene that would affect frame rate and performances way more.
Bye,
Jean