[游戏开发-学习笔记]菜鸟慢慢飞(13)- NGUI-代码设置锚点

有时候,可能会需要后台设置gameobject的锚点

        UIPanel uipanel = this.gameObject.GetComponent<UIPanel>();
        uipanel.SetAnchor(GameObject.Find("UI Root"));
        uipanel.leftAnchor.absolute 0;
        uipanel.rightAnchor.absolute 0;
        uipanel.topAnchor.absolute 0;
        uipanel.bottomAnchor.absolute 0; 
原文地址:https://www.cnblogs.com/workhai/p/6688904.html