Hello Guest

Author Topic: Layer transparency  (Read 5776 times)

DJVDJV

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 30
    • View Profile
Layer transparency
« on: November 17, 2016, 01:28:01 pm »
How to set transparency for one specific layer in Tk2d Tilemap?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Layer transparency
« Reply #1 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?

DJVDJV

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 30
    • View Profile
Re: Layer transparency
« Reply #2 on: November 29, 2016, 09:48:40 pm »
In runtime. I try make water layer that changes transparency. (So I can see rocks "underwater")

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Layer transparency
« Reply #3 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.