1
NGUI 3 Support / Change UITexutre's material offset at runtime didn't work like it in 2.x
« on: October 15, 2013, 01:55:27 AM »
I'm using 3.0.2
reproduce step:
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.
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;
- }
- }