I’m trying to create a Button with a texture of png type but somehow a variable that should reference my image has a null value. In unity it’s assigned to, so I have no idea what’s wrong. Here comes the code and a screen of an image properties:
public var image:Texture2D;
public class BuildingsPanel extends PanelState{
private var _icons:Array;
private var _buildings:Array;
public function BuildingsPanel(name:String, panel:Panel){
super(panel, name);
var i:int = 0;
var n:int = 0;
_icons = new Array(12);
_buildings = new Array(12);
while(i < 3){
while(n < 4){
_icons[i*4+n] = Rect(50.0*n, i*50.0, 50.0, 50.0);
_buildings[i*4+n] = new UnitPanel("UnitPanel", _panel);
++n;
}
n = 0;
++i;
}
}
//main methods
public function changeState(){
_panel.setState(new UnitPanel("UnitPanel", _panel));
}
public function draw(){
var i:int = 0;
GUI.BeginGroup(_rect);
GUI.Box(_currentBox, _name);
Debug.Log(image);
while(i < 12){
if(GUI.Button(_icons*, image)){*
-
changeState();*
-
}*
-
++i;*
-
}*
-
GUI.EndGroup();*
- }*
}
ImageShack - Best place for all of your image hosting and image sharing needs