- Home /
Texture 2D array to GUI.Window rows iOS
I'm trying to make a scrollable GUI.Window with each row containing a seperate color swatch for users to tap.
I can assign a Texture2D to each row, however I'm simply having a problem cycling through an array of Texture2D so each row has a different color.
public var myTextures : Texture2D[];
Setting up table, rows and button behavior:
function DoWindow (windowID : int) //build table
{
var listSize : Vector2 = Vector2(windowRect.width - 2*listMargin.x,
windowRect.height - 2*listMargin.y);
var rScrollFrame :Rect = Rect(listMargin.x, listMargin.y, listSize.x, listSize.y);
var rList :Rect = Rect(0, 0, rowSize.x, numRows*rowSize.y);
scrollPosition = GUI.BeginScrollView (rScrollFrame, scrollPosition, rList, false, false);
var rBtn :Rect = Rect(0, 0, rowSize.x, rowSize.y);
This is where I start run into trouble getting the Texture2D array to cycle through:
for (var iTex : int = 0; iTex < numRows; iTex++) {
for (var iRow : int = 0; iRow < numRows; iRow++)
{ var fClicked : boolean = false; var rowLabel : String = "Row Number " + iRow;
`//this is what will be written in the rows
if ( iRow == selected )
{
fClicked = GUI.Button(rBtn, rowLabel, rowSelectedStyle);
}
else
{
fClicked = GUI.Button(rBtn, myTextures[iTex]); //trying to cycle through array colors here
}
}
}
GUI.EndScrollView();
}
Not sure what where I'm missing here, but I'm pretty sure I'll hit myself once I can figure it out...
Comment
Your answer
Follow this Question
Related Questions
How to access a texture2d from another scene 1 Answer
Texture2d.LoadImage too slow for use (iOS) 1 Answer
Loading Textures from AssetBundle 0 Answers
My App Size is Too Large on iOS Because of Textures 0 Answers
Texture2D Array Appears Grainy 0 Answers