2D Toolkit Forum

2D Toolkit => Support => Topic started by: biggo on September 18, 2014, 06:42:34 am

Title: Tilemap layer opacity
Post by: biggo on September 18, 2014, 06:42:34 am
Hi there! :)

Is it possible to control the opacity of a layer in a tilemap? At certain parts in my game, I need to make a wall invisible - thus having it "fade away".

Can this be accomplished somehow? ???
Title: Re: Tilemap layer opacity
Post by: unikronsoftware on September 18, 2014, 10:15:23 am
Not directly, but if you use a different sprite collection / set of sprites per layer, you can override the the material to use use one with a tint parameter which you can tint to fade an entire layer.
Title: Re: Tilemap layer opacity
Post by: biggo on September 18, 2014, 11:36:36 am
Not directly, but if you use a different sprite collection / set of sprites per layer, you can override the the material to use use one with a tint parameter which you can tint to fade an entire layer.

I'm not sure what you mean by overriding the material? Could you elaborate a bit?

Also, how can I use a different sprite collection per layer? I don't understand how that can be accomplished?



Title: Re: Tilemap layer opacity
Post by: unikronsoftware on September 19, 2014, 02:54:26 pm
I don't know how you've got your sprites set up. If each layer has unique sprites, then you can override materials for those sprites (http://2dtoolkit.com/docs/latest/tutorial/multiple_materials_in_a_sprite_collection.html) and then change the opacity on the material. You will obviously need a material that does that, the default tk2dsprite material doesn't do it but one of the Unity transparent unlit ones will.
Title: Re: Tilemap layer opacity
Post by: biggo on September 19, 2014, 07:02:59 pm
Awesome! That works perfectly - thanks a lot! :D