I'm using 3.0.2
reproduce step:
- Create a new scene.
- Through menu [NGUI] -> [Create] -> [Texture]
- Assign "Fantasy Atlas" material provided from NGUI package to UITexture's material
- Attach the code below
- Hit Play
In my game, I use a custom shader to mask the texture, so I can't use UITexture's UV setting.
I tried MarkAsChanged(), it didn't work.
Disable/Enable UITexture or panel.Refresh() work, but I think I should not do that at runtime.
How do I make it work in 3.0.2 ?
Thanks.
using UnityEngine;
public class UITextureOffset : MonoBehaviour
{
float offset;
UITexture tex;
void Start()
{
tex = GetComponent<UITexture>();
}
void Update()
{
offset += Time.deltaTime;
if (offset > 1)
offset = 0;
tex
.material.mainTextureOffset = new Vector2
(offset,
0); }
}