I would like to scroll a texture from right to left on a plane.
How can I do this ?
I was thinking of making an array with different texture and render one after the other. It would be nice to always have texture on that plane to make it look like skyscrapper in NY.
This is the most powerful answer here, as it changes the mesh's UV map, letting you do more than just fiddle with the offset. (Thought fiddling with the offset might have worked for the original question, assuming the UV map was set up properly.)
//scroll main texture based on time
var scrollSpeed : float = .5;
var offset : float;
var rotate : float;
function Update (){
offset+= (Time.deltaTime*scrollSpeed)/10.0;
renderer.material.SetTextureOffset ("_MainTex", Vector2(offset,0));
}
now this works going from left to right but if anyone can tell me how to change which direction it scrolls id really appreciate it. I’m trying to make a water fall but its falling to the left not down lol
Change the line to the following: renderer.material.SetTextureOffset ("_MainTex", Vector2(0,-offset));
If you mean tile, like bricks/windows on a building, play with the Tiling numbers on the material. If you mean animated, then animate the offsets on the material.
What I mean is I want texture like commercial, pub scrolling on a buildingface to make it look like it is advertisement.
That's called a marquis, you probably mean the one in Times Square. Animate the X (or Y) number on the material that has your texture. You can do that with a script or the animation editor
Use the animation editor. Put the texture on a material, put the material on a Plane. Select the plane, Ctrl-6, find the material's X offset, have it go from 0 to 1, and set to 'loop'. Play. that's all
using UnityEngine;
using System.Collections;
public class ExampleClass : MonoBehaviour {
public float scrollSpeed = 0.5F;
public Renderer rend;
void Start() {
rend = GetComponent<Renderer>();
}
void Update() {
float offset = Time.time * scrollSpeed;
rend.material.SetTextureOffset("_MainTex", new Vector2(offset, 0));
}
}
This is the most powerful answer here, as it changes the mesh's UV map, letting you do more than just fiddle with the offset. (Thought fiddling with the offset might have worked for the original question, assuming the UV map was set up properly.)
– unity_bTkJGG31azdikQ