- Home /
Question by
buxton4life · Jul 17, 2012 at 10:01 AM ·
guiiosmenuif
onGui - Switching between textures on selection grid.
Morning guys,
I have made a level select screen for my iphone/ipad game using a selection grid all looks good but I ran into a problem as I want some of the textures to have a locked textures and some to be playable. So when a user completes level 1 the texture for level 2 changes from locked to a new texture.
Just wondering where I would put the if statement? Any help would be appreciated. Thank you!
Here is my code so far -
var selGridInt : int = 0;
var selStrings : String[] = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18"];
public var customSkin : GUISkin;
public var menuStyle = new GUIStyle();
function Awake(){
useGUILayout = false;
selGridInt = -1;
}
function OnGUI () {
GUI.skin = customSkin;
selGridInt = GUI.SelectionGrid (Rect (Screen.width / 24, Screen.width / 6, Screen.width / 1.08, Screen.height / 1.6), selGridInt, selStrings, 6);
if(selGridInt > -1){
Application.LoadLevel(selGridInt);
}
}
Comment