is there any uv animation scripts I can buy or download that allows me to scroll a texture across a plane or mesh face? thanks for the assistance.
You might wanna check around the asset store forum area for that sort of thing.
If you wanna take a crack at writing it yourself, it’s pretty easy. You need to get a reference to the Material involved, and then move the texture offsets if you just want gross scrolling to happen. The field shortcut in your material object is .mainTextureOffset and it is a Vector2.
If you want weirder per-UV stuff, then you will need to read the mesh info out of the MeshFilter, figure out what verts you want, and update their individual UV coords, which is a bit more involved.
I am not a scripter kurt lol. so yeah but I also searched on the asset store and nothing popped out as somethgin that could help me with that very thing. or maybe my search words were less than specific, anyone know what popular apps that can do that?
using UnityEngine;
public class MoveUVS : MonoBehaviour
{
float _updateDelay = 0.05f;
float _nextUpdateTime;
public Renderer Rend;
Vector2 _offset = new Vector2(0, 1);
Vector2 _uvOffset = Vector2.zero;
public bool _isWater;
bool _set;
void Update()
{
if (_isWater)
{
_uvOffset += _offset * Time.deltaTime;
Rend.material.SetTextureOffset("_MainTex", _uvOffset);
}
else
{
if (Time.time > _nextUpdateTime)
{
_nextUpdateTime = Time.time + _updateDelay;
_set = !_set;
if (_set)
{
_uvOffset += _offset * Time.deltaTime;
Rend.material.SetTextureOffset("_MainTex", _uvOffset);
}
else
{
_uvOffset -= _offset * Time.deltaTime;
Rend.material.SetTextureOffset("_MainTex", _uvOffset);
}
}
}
}
}
I made a mincrafty type game and used this code to make it look like running water if _isWater is true or shimmer like a fire. Add this script to your object and drag the renderer into the slot in inspector.
thanx vintar i will give that a whirl, I will report back to you.
got it to apply tot he object, but nothing happens after I apply the renderer.