- Home /
Make more GUI per int
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]);
}
}
Comment
Best Answer
Answer by darkal · May 18, 2016 at 02:53 PM
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), "");
}**
}
}
Your answer
Follow this Question
Related Questions
IGUI IOS error 1 Answer
Distribute terrain in zones 3 Answers
Health Bar Percentages Problem 2 Answers
Multiple Cars not working 1 Answer
How to force refresh mouse position? 2 Answers