Applying offset to a texture via script

Hello guys, I tried to search something about this but I only found how to apply an offset in a Material, but I want to apply it in one Texture2D that I am using in a fade-in of a level. Can someone help me, thanks.

There are two ways to render Texture2Ds in Unity:

  1. If you want to render a texture on the surface of a mesh you have no choice but to assign it to a material and tweak the tiling and offset values.

  2. If you use it within the GUI system you can do the same by calling:

    Rect position = new Rect(0, 0, width, height);
    Rect texCoords = new Rect(offsetX, offsetY, 1, 1);
    bool alpha = true;
    GUI.DrawTextureWithTexCoords(position, texture, texCoords, alpha);

In both cases, make sure to set the wrap mode in the Texture2D import settings to ‘Repeat’ and not ‘Clamp’.