using UnityEngine;
using System.Collections;
public class ActionsButtons : MonoBehaviour {
//actions needed
public IAction action2;
public IAction action3;
public IAction action1;
//if showed
public bool showButtons;
//send a mesage
public string message;
//buton id
public int nextId;
//prefab
public GameObject btn1;
//array where all the button would be
public GameObject[] children;
public void Start ()
{
//initialing array with 3 spaces for 3 buttons
GameObject
[] children
= new GameObject
[3]; //finding the root UI
GameObject parent = GameObject.Find("UIGUI");
//child.name = "newbutton" + (nextId++);
//loop than will fill each space with a button
foreach(GameObject item in children)
{
//parents each button to the root
GameObject child = NGUITools.AddChild(parent, btn1);
//gives the name of each button
child.name = "newbutton" + (nextId++);
//child.transform.localScale = Vector3.one;
}
}
}