Is it possible to scroll a specific distance with
renderer.material.SetTextureOffset (“_Illum”, Vector2( 0, offset));
I have a 512*512 texture with horizontal lights every 32 pixels.
So I would like for my (_Illum) texture to move 32 pixels every half second,
so it looks one light goes out while the other goes on.
This is what I have so far:
var isEnabled : boolean = true;
var lighteffectsObject : Transform;
var offsetDistance : float = 0.06;
private var offset : float = 0;
function Awake()
{
StartLoop();
}
function StartLoop()
{
while(isEnabled)
{
yield WaitForSeconds(0.5);
offset += offsetDistance;
lighteffectsObject.renderer.material.SetTextureOffset ("_Illum", Vector2( 0, offset));
}
}
Any idea’s?