so ik how make one GUI but how do i make it so the GUI make itself with Int amount like if i have 1 it make one box if i have 5 it will make 5 boxes? this is for scroll bar inventory btw so needs to scroll but just need know how do this i can do rest
using UnityEngine;
using System.Collections;
public class inventest : MonoBehaviour {
public int maxslot;
public int currslot;
public GameObject[] items;
public string[] itemname;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
void OnGUI()
{
GUI.Box(new Rect(0, 0, 200, 25), itemname[currslot]);
}
}
this is answer to make it make more simpler then i thought thanks anyway
using UnityEngine;
using System.Collections;
public class inventest : MonoBehaviour {
public int maxslot;
public int currslot;
public GameObject[] items;
public string[] itemname;
public int[] durability;
public int[] resistance;
public int[] damage;
public int[] restoration;
public bool[] equipable;
public bool[] comsumable;
public bool[] buildable;
//public enum type{equip, build, comsumable};
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
void OnGUI()
{
//GUI.Box(new Rect(0, 0, 200, 25), itemname[currslot]);
**for (int i = 0; i < maxslot; i++)
{
GUI.Box(new Rect(0, 0 + (20 * i), 100, 20), "");
}**
}
}