I want a billboard-lights material that has animating lights.
So I made a scrolling-texture animation by animating the main texture offset.
Now the thing is, if I want something to have this material, I have to give that object an animation component and add that animation to it. And this also creates a new material for each object.
But I don’t want it to make copys of the material each time it’s used, I just want all these objects to use the same animated material without having to give it an animation component.
(So what I really want is to store that animation in the material somehow)
Does anyone know how I can do something like this ?
Edit:
I made a script to this instead:
var mat:Material;
function Update ()
{
var offset:float = Mathf.Repeat (Time.time*2,1);
offset = Mathf.FloorToInt(offset*4)/4.0f; //clampen op 1/4
Debug.Log("offset: "+offset);
mat.mainTextureOffset.x = offset;
mat.SetTextureOffset("_IlluminTex", new Vector2(offset,0));
}
only problem is that I don’t know what the Self-Illumination Texture is called.
Anyone knows were to find it ?
EDIT2:
found it, it’s “_Illum”
If anyone wants to findout how something else is called in the build-in shaders, you can find the shaders here: http://unity3d.com/download_unity/builtin_shaders.zip