效果
请右键在新标签页中打开图片
代码
using UnityEngine;
using System.Collections;
public class CreatButton : MonoBehaviour
{
public GameObject buttonPrefab;
// Use this for initialization
void Start ()
{
}
// Update is called once per frame
void Update ()
{
}
void CreatNewBotton()
{
GameObject button = Instantiate(buttonPrefab, transform.position, Quaternion.identity) as GameObject;
button.transform.parent = transform;
button.transform.localScale = new Vector3(1,1,1);
gameObject.GetComponent<UIGrid>().repositionNow = true;
}
}