- Home /
Question by
PersianKiller · Aug 04, 2017 at 08:01 AM ·
c#beginnermoving-platform
need help about these codes
hi it's the code,I used it for an endless backGround and it works fine.but I have some questions.
void Update () {
Vector2 offset = new Vector2 (Time.time * 1, 0);
GetComponent<Renderer> ().material.mainTextureOffset = offset;
}
what's the difference between Time.deltaTime and Time.time and line 2, can anyone explain what does that do?
Comment
Best Answer
Answer by ktitov3d · Aug 04, 2017 at 08:12 AM
Time.deltaTime is time between previous frame and current frame. https://docs.unity3d.com/ScriptReference/Time-deltaTime.html
Time.time is the time in seconds since the start of the game. https://docs.unity3d.com/ScriptReference/Time-time.html
In line 2 X-axe will be increasing over time because time.time is always go up. You are basically will move texture infinitely for by changing uv coordinates.