2D Toolkit Forum

2D Toolkit => Support => Topic started by: DJVDJV on November 17, 2016, 01:28:01 pm

Title: Layer transparency
Post by: DJVDJV on November 17, 2016, 01:28:01 pm
How to set transparency for one specific layer in Tk2d Tilemap?
Title: Re: Layer transparency
Post by: unikronsoftware on November 29, 2016, 06:41:27 pm
There isn't a way to do this out of the box - are you after something that will let you set the colour in the editor or at runtime?
Title: Re: Layer transparency
Post by: DJVDJV on November 29, 2016, 09:48:40 pm
In runtime. I try make water layer that changes transparency. (So I can see rocks "underwater")
Title: Re: Layer transparency
Post by: unikronsoftware on November 30, 2016, 06:15:12 pm
The easiest way to do this is to use a material that has a tint colour - then all you need to do is find the tilemap render data > layer you're interested in, layer.GetComponentsInChildren<MeshRenderer>() and for every renderer do .material.color = new Color(1,1,1,0.5) or something along those lines. That will let you tint that layer at runtime in a really efficient way.