if(Time.time % 2 > 1)
{
GUI.DrawTexture(helloRect, picture1);
}
else
{
GUI.DrawTexture(helloRect, picture2);
}
How can I let this "blink" more often?
if(Time.time % 2 > 1)
{
GUI.DrawTexture(helloRect, picture1);
}
else
{
GUI.DrawTexture(helloRect, picture2);
}
How can I let this "blink" more often?
Something like:
if((Time.time * speed) % 2 > 1)
would be the quickest way to do it
Time.time is a float, not sure that % 2 of that would ever really be more than 1? Anyway there's a lot of ways to set up timers. I usually do something like this:
var rate = .5; // seconds
var lastCheck = 0.0;
Update()
{
if ((Time.time - lastCheck) >= rate)
{
Do Something
lastCheck = Time.time;
}
}
which will 'Do Something' every 'rate' seconds. So you could toggle a boolean and pick a texture then. Smaller values of 'rate' will do it faster
Regarding OnGUI - you'd have to check the time when Event.current.type == EventType.Repaint only
– anon85704231
thanks for the answer
– anon47167959