- Home /
Question by
Platiniumekk · Jul 17, 2017 at 03:38 PM ·
guipositioninventoryrecttransformrect
Setting a Rect from another RectTransform
Hi guys! I have little problem, i making a gui inventory and i want to set item icon in slot position but icons are setting in strange position. mirrored horizontaly etc.
here is my script.
private void OnGUI()
{
for (int i = 0; i < 40; i++)
{
if (item[i] != null) itemIcons(item[i], equipment[i]);
}
}
void itemIcons(GameObject obj, RectTransform pos)
{
GUI.Box(pos.rect, obj.GetComponent<Item>().icon);
if(obj.GetComponent<Item>().stack > 1) GUI.Label(pos.rect, "" + obj.GetComponent<Item>().stack);
}
Thanks in advance for answers :)
Comment