Unity3D_07_日志、文本打印

1.Debug.Log(“hello”);

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

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

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

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

1 this.lbRightHandRotation.text = string.Format  
2 ("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(“打印”);

posted @ 2018-04-28 15:35  MR_L先生  阅读(506)  评论(0编辑  收藏  举报