- Home /
Scroll GUI Texture
Hi,
I have made my game and I need to add a credits page now. I made a fancy list of credits on PhotoShop and imported them in Unity and used it as a texture. All the answers I've found so far only tell how to scroll text upwards, like in credits. I haven't been able to find something to help me with scrolling GUI Texture. Please let me know how can I do that and include speed within the code too.
Thanks.
I cannot locate any "OFFSET". Currently, my scene just has a black plane, as a child of Camera and GUITexture on the plane.
Answer by robertbu · May 05, 2013 at 10:11 PM
As far as I know, you can't get access to the material for GUITextures, so you cannot change the material offset like you could for something normal game object. You can translate the GUITexture, so if the plane were bigger than what was shown on the screen (or if you build a viewport), you could put something like this in Upate()
transform.position += Vector3.up * speed * Time.deltaTime;
Note GUITextures live in Viewport space.
Answer by Mystic_nynja · Apr 19, 2014 at 08:57 PM
Hey just found this post, hopefully I can still help out.
I found if you use DrawTextureWithTexCoords.
http://docs.unity3d.com/Documentation/ScriptReference/GUI.DrawTextureWithTexCoords.html
GUI.DrawTextureWithTexCoords(Rect position, Texture2D Texture, Rect TexCoords);
so if you change the x value on the TexCoords then this will scroll that texture. Hope that helps!
Example
GUI.DrawTextureWithTexCoords(myRect, myTexture, new Rect(speed * Time.time, 0, 1, 1));