Hello,
I’ve been trying to get a bit of code working. below is a truncated version for demonstration purposes. I’m trying to figure out how to store an array of GUITextures, that I can then access values to. I’ve banged my head against this all day, and I have not found a very good example online of how this is achieved. Here is what I am trying to do.
I have been able to create the array, but not populate it. Since, I have not achieved that I also do not know if the color assignment, position and scale variables have been set. I think those should work, but then a again, I must be missing something fundamental. Is GUITextures just not intended to be scripted? I find that hard to believe. If anyone has any ideas I would love to hear them.
Best Regards,
Stephen
var numberOfButtons:int = 7;
var buttonBGArray = new GUITexture[numberOfButtons];
for(var x:int = 0; x < numberOfButtons; x++)
{
var bgColor:Color;
bgColor = Color(1,0,0,.5);
buttonBGArray[x].texture = textureArray[categoryTextureNumber];
buttonBGArray[x].color = bgColor;
buttonBGArray[x].transform.position = Vector2(xPlacement,yPlacement);
buttonBGArray[x].transform.localScale = Vector2(buttonWidth,buttonHeight);
}
What is textureArray? What is categoryTextureNumber?
– jahroy