NGUI聊天界面简单实现

void Update()
    {
        if (inputLabel.text!= "")
        {
            
            if (Input.GetKeyDown(KeyCode.Return))
            {

                message = start2 + inputLabel.text.Replace("|", "") + "\n";
                message = message.Insert(10, "\n");
                _tempLabel = Instantiate(label, labels.transform.localPosition, Quaternion.identity) as GameObject;

                _tempLabel.transform.parent = labels.transform;
                _tempLabel.transform.localScale = new Vector3(1, 1, 1);
                _tempLabel.GetComponentInChildren().text = message;
                inputLabel.text = "";
                labels.GetComponent().repositionNow = true;
            }
        }
        

    }
NGUI聊天界面简单实现_第1张图片

你可能感兴趣的:(Unity,label,Unity3D)