I want to make a scrolling texture for my scrolling menu. And Im newbie in Unity 3d, i just don't have any idea how to do that..i put a sort of guitexture to as a prototype for my instruction menu. i really need some help. Thanks. ^^
A GUITexture is a quad with UVs that utilize the full extents of the 0-1 space, so you can't do what you need to do with them. You'll need something that takes a material, so you can control the matrix that is applied to the mesh's UVs. This is easily done with Unity's "Offset", per-texture. I recommend a quad. A Line Renderer or Unity's plane will work, if you don't know how to model one. (But really, you should know or learn that.)
I could be wrong but you might want to do something like this:
using UnityEngine;
using System.Collections;
public class ScrollingTextureTest : MonoBehaviour
{
//Sets the GUI.skin
public GUISkin skin;
//Set the speed the credits scroll at
public float scrollSpeed;
//Holds the Position Rect for the GUI.Label
private Rect positionRect = new Rect();
// Use this for initialization
void Start ()
{
}
// Update is called once per frame
void Update ()
{
}
void OnGUI()
{
GUI.skin = skin;
//Builds the GUI.Labels
GUI.Label(positionRect, "", "ScrollingTexture");
//Changes the position of GUI.Label
positionRect.x = positionRect.x - (scrollSpeed * Time.deltaTime);
}
}
You’ll need to create a GUISkin, in case you haven’t done this before you create a folder in your project pane right click on it Create->GUISkin.
After you create the GUISkin you click on it expand the custom styles option.
There you create a style named ScrollingTexture and put your texture that you want to be scrolling in the normal texture area.
Drag the skin onto the public variable called skin in the inspector, set the scrolling speed variable and away you go.
You’ll have to add checks so when the texture is off screen it:
A) reverses direction or
B) Resets to the other side of the screen or whatever you want the functionality of the texture to be.
Here’s the link to the GUISkin stuff.
Hope that helps,
Hans