Unity3D 07-日志、文本打印

来源:互联网 发布:联通大数据平台 编辑:程序博客网 时间:2024/06/06 03:09

1.Debug.Log(“hello”);

2.打开控制台查看日志:ctrl+shift+c

3.输出一个位置的坐标(需要转换成字符串.ToString())

Vector3 worldPosition = hc.transform.TransformPoint(unityPosition);  Debug.Log("worldPosition" + worldPosition.ToString());  

4.文本输出多个变量,需要用占位符

this.lbRightHandRotation.text = string.Format  ("Right Hand Rotation:{0},{0},{0}", h.Direction.Pitch.ToString() ,h.Direction.Yaw.ToString(), h.Direction.Roll.ToString());  

5.文本打印(hour等是int类型)

time_text.text = hour.ToString() + "时" + min.ToString() + "分" + sec.ToString() + "秒";  

6.如果使用using System.Diagnostics;
CS0104 ‘Debug’ is an ambiguous reference between ‘System.Diagnostics.Debug’ and ‘UnityEngine.Debug’
如果此时想要打印日志,直接用print(“打印”);

原创粉丝点击