UnityTowerDefense/Assets/HEROIC FANTASY CREATURES FULL PACK VOL 1/Demonic Creatures Pack/Demon Lord/Script/ScrollingUVs.cs

20 lines
No EOL
543 B
C#

using UnityEngine;
using System.Collections;
public class ScrollingUVs : MonoBehaviour
{
public int materialIndex = 0;
public Vector2 uvAnimationRate = new Vector2( 1.0f, 0.0f );
public string textureName = "_MainTex";
Vector2 uvOffset = Vector2.zero;
void LateUpdate()
{
uvOffset += ( uvAnimationRate * Time.deltaTime );
if( GetComponent<Renderer>().enabled )
{
GetComponent<Renderer>().materials[ materialIndex ].SetTextureOffset( textureName, uvOffset );
}
}
}