#Fadeout parent object with tilemap renderers

1 messages · Page 1 of 1 (latest)

viral verge
#

So I'm making this game where when you finish the level, new level fades in (in the same scene). I'm looking for a way to fade out tilemap renderers and sprite renderers (Fence, Bricks...) that are children objects of the parent (Level1).

The question: What can I do to the parent object (Level1) to fade out all the children objects? Does unity have some sort of a system or do I need to code that?

modest ferry
#

I think you can fade out the tilemaps by adjusting their tilemap renderers material color, lerp the alpha to 0 over some time

#

maybe I am not understanding though. The Lavel1 game object is a tilemap and the Fence, Bricks, NoGrip are sprites?

viral verge
#

Level1 is an empty gameobject that just houses all the level parts. Fence, Bricks and NoGrip are tilemaps, and finish is a sprite

#

Maybe I can get all level1's children, check what renderer they have and fade them out? That would work

#

I just want to make sure that when I add more stuff to each level, they will still fade out.

modest ferry
#
// if you want to get all of the tilemap renderers in the children of a parent game object you can use 
_tilemapRenderers = GetComponentsInChildren<TilemapRenderer>()
#

that will give you an array of tilemap renderers you can iterate through and fade out