美文网首页
Unity3D动态实例化按钮

Unity3D动态实例化按钮

作者: IcodeIlife | 来源:发表于2016-07-19 16:24 被阅读0次

    琢磨了一天之后,终于搞定了,动态实例化按钮,代码如下:
    GButton btnLeagueList;
    GameObject family_task;
    family_task = Instantiate(btnLeagueList.gameObject) as GameObject; btnLeagueList.Text = "门派任务"; if (family_task != null) { family_task.transform.parent = transform; family_task.transform.localScale = new Vector3(1, 1, 1); family_task.transform.localPosition = new Vector3(218, -230, 0); } thisCtrl = this; Debug.Log(123);
    注意 脚本在实例化的时候,实例化对象必须是gameObject;

    相关文章

      网友评论

          本文标题:Unity3D动态实例化按钮

          本文链接:https://www.haomeiwen.com/subject/mmgmjttx.html