unity3D报NullReferenceException: Object reference not set to an instance of an object

来源:互联网 发布:linux创建文件链接命令 编辑:程序博客网 时间:2024/06/05 00:49
我是在用unity3D制作2D游戏时将世界(像素)坐标转换成屏幕坐标Camera.main.ScreenToWorldPoint(Input.mousePosition)报NullReferenceException: Object reference not set to an instance of an object的错,解决办法是检查MainCamera的tag值有没有设置成MainCamera,如果没有,就会报这个错。
0 0
原创粉丝点击