【Unity3d学习之一】Unity3d异常报错的处理

来源:互联网 发布:windows vista 版本 编辑:程序博客网 时间:2024/06/06 19:14

Unity3d在使用模拟器运行时,遇到异常,如NullReferenceException的时候会暂停运行。我们可以通过关闭控制界面上的Error pause开关使程序继续运行。

Unity3d的异常处理和C#一样,也是通过try{}catch(Exception e){}来处理。但是需要在脚本引入System的namespace,否则会报错:

The type or namespace name `eException' could not be found. Are you missing a using directive or an assembly reference?

using System;


原创粉丝点击