赞
踩
Unity3D的纹理贴图循环运动。
用法很简单,把以下脚本放在有贴图的gameobject上就可以了。贴图最好用psd格式的,jpg格式的不行。
- #pragma strict
- // Scroll main texture based on time
- var scrollSpeed = -0.5;
- // This must be set to override a bug where Render Order
- // of the tunnel objects is lost when SetTextureOffset is used
- var queue = 0;
- private var offset = 0.0;
- function Update ()
- {
- offset = Time.time * scrollSpeed;
- renderer.material.SetTextureOffset ("_MainTex", Vector2(offset,0));
- renderer.material.renderQueue = queue;
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。