I am trying to create a dynamic health bar using little dots to show health. I want to use the LayoutContainerSizer. I am getting an index out of bounds error. I couldn't find docs on how to do this so I'm working blind. Anyone have a hint?
thanks!
-Nic
code follows
public class UI : MonoBehaviour {
public tk2dUILayoutContainerSizer healthUIContainerSizer;
// Use this for initialization
void Start () {
AddMaxHealth();
}
// Update is called once per frame
void Update () {
}
void AddMaxHealth()
{
GameObject go = (GameObject)Instantiate(Resources.Load("UI/HealthBarLength"));
tk2dUILayout layout = go.GetComponentInChildren<tk2dUILayout>();
//layout.layoutItems[0];
//tk2dUILayoutItem item = go.GetComponentInChildren<tk2dUILayoutItem>();
healthUIContainerSizer.AddLayoutAtIndex(layout,layout.layoutItems[0],1);
}
}