I try to repeat the background image on the GUILayout. After i search from the website, not able find out how to repeat the image.
is that can tell me why? or how i can make the windows background image able to auto fill?
below is my code.
Texture2D LzIMGBackground;
LzIMGBackground = Resources.LoadAssetAtPath("Assets/Textures/UI/Resources/metal-background-texture.jpg",typeof(Texture2D)) as Texture2D;
GUILayout.BeginVertical (LzIMGBackground, "box");
GUILayout.BeginVertical ("box");
if(GUILayout.Button("Single Player",GUILayout.Width(200))){
Application.LoadLevel("testGUITransitions");
}
GUILayout.EndVertical ();
GUILayout.BeginVertical ("box");
if(GUILayout.Button("Quit",GUILayout.Width(200))){
Application.Quit();
}
GUILayout.EndVertical ();
GUILayout.EndVertical ();
and i had attach the file for example. thanks a lot.
From this you need to use the 'GUI.DrawTextureWithTexCoords' function
var panelWidth = ...;
var panelHeight = ...;
yourTexture.wrapMode = TextureWrapMode.Repeat;
GUI.DrawTextureWithTexCoords(panelPos, yourTexture,
new Rect(0, 0, screenBounds.width / yourTexture.width, panelHeight / yourTexture.height));
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments