Im trying to add new progressbars to each new instantiated gameObject (soldiers).
These soldiers have a vitality script, and I have this bit into the vitality script.
public GameObject pbar; //my instantiated health bar.
public void Awake()
{
pbar = NGUITools.AddChild(GameObject.FindGameObjectWithTag("Panel"), pbar);
pbar.AddComponent<UIAnchor>();
pbar.GetComponent<UIAnchor>().container = this.gameObject;
}
However, it instantiates it the bars at 0,0,0.
Before, I only had addchild, and "pbar.transform.position = this.transform.position;" in Update Script, but I figured their was a better way to do it with Anchors.
any ideas on how to anchor the instantiated GameObject properly?