资源描述:
《Unity3D游戏开发之android下调试Unity3D应用》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、Unity3D游戏开发之android下调试Unity3D应用目前貌似不支持断点调试,但可以通过日志打印(logcat)来跟踪。在androidSDK中有个adb工具,使用此工具来跟踪运行的android应用:adblogcat启动logcat,并将设备上运行的android应用的运行时信息全部打印出来。adblogcat-sUnity如果只想打印Unity的输出信息,使用此命令。adblogcat-d>logcat.txt将打印信息输出为文件。文章出处【狗刨学习网】当然,更直接的做法是在应用中集成自己的调试信息窗口,将如下代码关联到一个ga
2、meobject:[csharp]viewplaincopy
usingUnityEngine;usingSystem.Collections;
publicclassGuiTextDebug:MonoBehaviour{privatefloatwindowPosition=-440.0f;privateintpositionCheck=2;privatestaticstringwindowText="";privateVector2scrollViewVector=Vector2.zero;privateGUIStylede
3、bugBoxStyle;privatefloatleftSide=0.0f;privatefloatdebugWidth=420.0f;publicbooldebugIsOn=false;publicstaticvoiddebug(stringnewString){windowText=newString+""+windowText;UnityEngine.Debug.Log(newString);}voidStart(){debugBoxStyle=newGUIStyle();debugBoxStyle.alignment=TextAn
4、chor.UpperLeft;leftSide=120;}voidOnGUI(){if(debugIsOn){GUI.depth=0;GUI.BeginGroup(newRect(windowPosition,40.0f,leftSide,200.0f));scrollViewVector=GUI.BeginScrollView(newRect(0,0.0f,debugWidth,200.0f),scrollViewVector,newRect(0.0f,0.0f,400.0f,2000.0f));GUI.Box(newRect(0,0.0f
5、,debugWidth-20.0f,2000.0f),windowText,debugBoxStyle);GUI.EndScrollView();GUI.EndGroup();if(GUI.Button(newRect(leftSide,0.0f,75.0f,40.0f),"调试")){if(positionCheck==1){windowPosition=-440.0f;positionCheck=2;}else{windowPosition=leftSide;positionCheck=1;}}if(GUI.Button(newRect(
6、leftSide+80f,0.0f,75.0f,40.0f),"清除")){windowText="";}}}}
文章出处【狗刨学习网】