2D Toolkit Forum
2D Toolkit => Support => Topic started by: David Kalina on March 03, 2014, 06:38:33 pm
-
Repro case:
1. Build a sprite collection with Atlas Format = PNG.
2. Add sprite to level.
3. Change sprite's shader to anything else.
4. Run the game. Sprite shader will reset to its default, which is undesired behavior.
Workaround: change sprite collection to Unity Texture format, rebuild, change atlas material, change sprite collection back to PNG atlas.
-
That is intentional behaviour. The material on the sprite is transient when its a png, or when its dynamically loaded for platforms and is managed by tk2d. It gets destroyed and recreated when the game starts. If you want to change the shader, change it on the actual material itself, or write a script to change it when the sprite changes (you can have multiple shaders within a collection, etc - you will need to cater for the features you use). You can use tk2dBaseSprite.SpriteChanged for notification when this happens.