I have this
public class InvUI : MonoBehaviour
{ public Texture2D inv_small;// i have set an image in the inspector
int btpx,btpy;
int btsx,btsy;
public class Item{
int value;
public Texture2D icon;
Item()
{value=0;
}
public int get_value(){ return value; }
public Texture2D get_icon(){ return icon; }
public void edit_value(int temp){
value = temp;
}
public void edit_icon(Texture2D temp){
icon = temp;
}
}
Item[ ] Inv =new Item[100];
void Start(){
for(int x=0;x<18;x++)
Inv[×].edit_icon(inv_small);
}
//as a nested class inside my main one; and this:
void OnGUI(){
GUI.Button (new Rect (btpx, btpy, 50, 50), Inv[1].icon);
GUI.Button (new Rect (btpx + btsx, btpy, 50, 50), inv_small);
GUI.Button (new Rect (btpx + btsx + btsx, btpy, 50, 50), inv_small);
}
void Update(){
//here i set values for btp i bts variables
}
}
and this doesnt work - doenst display buttons but it runs … however if i change [Inv[1].icon / Inv[1].get_icon()] to just [inv_small] in the script it works just fine