I would like to ask whether there is a simple solution to this problem. As far as I know (and understand) Defold, there is no general solution; however let me try…
I have a game object with various child objects; the three is not a-priori fixed since some child objects are created with (collection) factories. There is a way to set the tint of all the child objects?
Of course I can unfold the logic of creation of the objects and consider all possible cases… but at the moment this looks like a nightmare to me. On the other hand, a very simple solution is possible if I could access the child list… but this is impossible, isn’t it?
If you use collection factories to generate “prefabs” the messaging url is relative so you can always address “head” “body” etc. the same way directly.
But, as I tried to explain in my poor english, the three structure is not fixed. So I should use something like
if self.head then msg.(self.head, “set_tint”, {tint = …})
if self.body then msg.(self.body, “set_tint”, {tint = …})
…
and implement the reception of “set_tint” in the “prefabs”.
I read in other post in the forum that the list of children is not exposed by design. Another easy solution would be a recursive go.set_tint (url, tint): the tint of all the children of url is (componentwise) multiplied by tint.
Anyway, thanks for your great work with Defold!
Ciao!
@Pkeod I am sorry for the misunderstanding about normal user / Defold team member.
And let me say that I appreciate your help a lot!
My context is the following. I have various (quite large) icons for world selection in a menu. Each icon may have or have not certain children as indicators about the progress in the relative world. When the player select an icon to play, I want to make all icons vanish with alpha.
I ended creating my own child list for an icon; I fill it as I init the icon and I have implemented a message “set_tint” in any used collection in order to propagate down in the child three the tint setting command.