showRingMenu = true;
//GameObject go = NGUITools.AddChild(mPanel, mButtonPrefab);
//go.GetComponentInChildren<UILabel>().text = "text";
RingMenuOptions[0] = NGUITools.AddChild(mPanel, mButtonPrefab);
RingMenuOptions[0].GetComponentInChildren<UILabel>().text = "S";
RingMenuOptions[1] = NGUITools.AddChild(mPanel, mButtonPrefab);
RingMenuOptions[1].GetComponentInChildren<UILabel>().text = "W";
RingMenuOptions[2] = NGUITools.AddChild(mPanel, mButtonPrefab);
RingMenuOptions[2].GetComponentInChildren<UILabel>().text = "M";
RingMenuOptions[3] = NGUITools.AddChild(mPanel, mButtonPrefab);
RingMenuOptions[3].GetComponentInChildren<UILabel>().text = "E";
Vector2 center = new Vector2(0, 0);
float radius = 0.00000000000000000001f;
for (int idx = 0; idx < 4; ++idx)
{
//RingMenuOptions[idx].GetComponent<Transform>().Translate (center.x+radius * Mathf.Cos ((float)idx*Mathf.PI*2f/4+Mathf.PI*1.5f), 0f, 0f);
//RingMenuOptions[idx].GetComponent<Transform>().Translate (0f, center.y+radius * Mathf.Sin ((float)idx*Mathf.PI*2f/4+Mathf.PI*1.5f), 0f);
RingMenuOptions[idx].transform.localposition.x = center.x+radius * Mathf.Cos ((float)idx*Mathf.PI*2f/4+Mathf.PI*1.5f);
RingMenuOptions[idx].transform.localposition.y = center.y+radius * Mathf.Sin ((float)idx*Mathf.PI*2f/4+Mathf.PI*1.5f);
Debug.Log (RingMenuOptions[idx].transform.localposition.x);
Debug.Log (RingMenuOptions[idx].transform.localposition.y);
}
I am trying to make a ring menu, that displays the menu as a ring.
My problem is that the buttons keep showing up in the same position, no matter how small the radius of the ring is.
It shows 1, -1 etc. On Debug.Log.
But when I check with inspector by clicking the Instantiated clone of the prefab, it shows something like y = 212 or y = -212?
Result is the same with attaching buttons to anchor or panel.