Hello Guest

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - spudubi

Pages: [1]
1
Support / Re: Change 2dTk shader of sprite at runtime
« on: January 16, 2014, 11:49:17 am »
Wow, thanks for your fast reply!

Now it works!

Is this method the best method (performance wise) to change the render style of a sprite to additive rendering during runtime?

2
Support / Change 2dTk shader of sprite at runtime
« on: January 16, 2014, 11:17:12 am »
Hi,

My Sprite Collection uses a material with the 2dTk "BlendVertexColor" shader. I'm creating sprites from that collection at runtime like this:

Code: [Select]
tk2dSpriteCollectionData spriteCollection = Resources.Load("HexTilesData", typeof(tk2dSpriteCollectionData)) as tk2dSpriteCollectionData;
tk2dSprite tileSprite = tk2dSprite.AddComponent(goTemp,spriteCollection, "hexBorder");

Now I'm trying to change the shader of one sprite at runtime to the 2dTk shader "AdditiveVertexColor" like this:

Code: [Select]
selectedHexTile.sprite.renderer.material.shader = Shader.Find("AdditiveVertexColor");
But it doesn't work. The Sprite will be rendered in solid pink  :). I guess that's because Unity can't find the "AdditiveVertexColor" shader. I tried to put the shader in a Resources folder but that didn't worked either.

What is the right way to change the shader?

Pages: [1]