Moving textures over a model

For a game, I want to move a texture on one of my models. In other words, I would want a water texture to move on the surface of the water itself, so it looks like the water is moving by itself. How would I script that?

1 Answer

1

All's you would need to do is change the texture's offset.

 renderer.material.SetTextureOffset("_WaveTex", Vector2(Time.time, 0));
 //or something similar.

Yep, that's true for C#. In UnityScript this would compile without errors as the default floating point format in UnityScript is float, not double as in C#. Anyways @Landern has changed the example so it's more clear for all users so thanks for the comment. I'm sure it will save us from further complains from coding beginners ^^.