Let's look at our tools:The problem is that I want an integer variable to be multiplied by the distance between two slides, like: Between countdown start (texture offset 0) to "3" is "y" (y=0.1650390625 in this case) pixels, 2*y is the distance between the 0 and "2", 3*y is the distance... blah, blah, blah
- we can create variables
- we can increment them every frame or by time
soooooo, look, without 'for' loop same function:
This method is much better for timed events because u'r sure nothing unexpected will happenCode:private var offset : float = 0; private var num : float = 1; private var timer : float = 0; private var timer2 : float = 0; function Update(){ timer += Time.deltaTime; if (timer >= 1.5){ timer2 += Time.deltaTime; if (timer2 > 1 && num < 5){ offset = Vector2 (0, -(num*0.1650390625)); renderer.material.SetTextureOffset ("_MainTex", offset); num ++; timer2 = 0; } } }![]()




Reply With Quote
