Search Unity

Why can't I alter a Texture offset on a material, if its used in a Mask or Scroll rect?

Discussion in 'UGUI & TextMesh Pro' started by JonPQ, Apr 30, 2019.

  1. JonPQ

    JonPQ

    Joined:
    Aug 10, 2016
    Posts:
    120
    using unity 5.6.3p3
    We have several prefab inserts that are placed into a scrolling layout. (imagine a leaderboard)
    I have a shader (that works with unity masks) to scroll a layer on one of those items to make a sheen/shining effect. It scrolls the texture's uv offset on a material.
    The material is on a "Image" its the background for the Ui object.
    This works great everywhere in the game except if you put it inside a hierarchy with a mask (scroll layout also needs a mask )
    I even tried passing a custom scroll value to the shader... but unity somehow also resets this.

    If my object is outside the mask it works fine. If its inside the mask, its as if my uv's are all locked to 0,0,width,height.

    If I hard-code a u,v offset in the shader.. it renders with those offsets ok. So unity is blocking those values being sent to the shader somwehow. How does it do this ? and why ?
    Or is there some extra code I need to add to support masks with texture offsets ?
    Is there any way to get around this issue ?

    Thanks in advance for any insight/help into this issue.
     
    Last edited: Apr 30, 2019