main texture scrolling but not normal map

here is my current script:

var scrollSpeed = 1.0;
var MainoffsetX = 0.0;
var MainoffsetY = 0.0;

var UseCustomTex = false;
var CustomTexName = "";

function Update () 
{
    var offset = Time.time * scrollSpeed;
    if(UseCustomTex){
	renderer.sharedMaterial.SetTextureOffset (CustomTexName, Vector2(MainoffsetX*offset, MainoffsetY*offset));
    }
    else{
    renderer.sharedMaterial.SetTextureOffset ("_MainTex", Vector2(MainoffsetX*offset, MainoffsetY*offset));
    
    }
}

this scrolls the main texture but not the normal map. what i would like to know is how i would go about scrolling both main texture and normal map at the same time.

cheers

1 Answer

1

Already answered: Texture Offset - bump AND main color - Unity Answers

thanks, however this is achieving the same thing but it is in a different context to my script i would like to know how i can do it not how other people can.

The concept is the same in both cases, specifically this line: cog.renderer.material.SetTextureOffset("_BumpMap", bOff); You need to set the texture offset for both _MainTex and _BumpMap, so just copy and paste the line from your script that scrolls the main texture and change it to act on the bump map.

solved it thanks anyway renderer.sharedMaterial.SetTextureOffset ("_BumpMap", Vector2(MainoffsetXoffset, MainoffsetYoffset));

that is exactly what he said to do.

it is similar not the same