
今天学习Unity做游戏开发时,测试时遇到一些问题,在这里总结下。 测试界面信息: 错误信息如下: 解决版本: 安装3DMax,如果安装了还报错,重装3DMax。 错误信息如下: Google引用StackOverflow: Whenever I press play on unity it always tells me: “GUI Window tries to begin rendering while something else has not finished rendering! Either you have a recursive OnGUI rendering, or previous OnGUI did not clean up properly.” even if I make a completely new and clean project it just keeps telling me this. It doesn’t really affect anything but its quite annoying please help! 答: Hi and Welcome, have you tried resetting your unity layout from the drop-down in the top right corner? I had the same problem after I tried to add the Halo effect on an object. Unfortunately, only restarting the IDE fixed the issue. 转载一些其他错误解决版本: 1.U3D经常莫名奇妙崩溃。 一般是由于空异常造成的,多多检查自己的引用是否空指针。 2.编码切换警告提示。 警告提示:Some are Mac OS X (UNIX) and some are Windows. This might lead to incorrect line numbers in stacktraces and compiler errors. Many text editors can fix this using Convert Line Endings menu commands. 编码格式问题,VS的话直接高级保存方案里面修改,一般我选的是UNICODE(UTF8代签名)MACINTOSH(CR),WINDOW下的可以选WINDOWS的格式,两边都要用的话,推荐选CR。 BUG:IOS下,游戏中的中文显示乱码。 解决方式:同上,修改改代码页的编码。UNICODE(UTF8代签名)MACINTOSH(CR) 3.中文界面解决问题。 monodevelop中文显示解决方法: http://www.cocoachina.com/bbs/read.php?tid-78563.html 中文Mac系统下MonoDevelop乱码解决: http://blog.csdn.net/ssihc0/article/details/6796118 4.安装空项目报错 不知道怎么地,在IOS试过一次空项目也在错误提示。大概是说什么“找不到需要的方法”。 重装一下就好了,估计是UNITY文件损坏或者安装不完全出错了。重装吧。 错误提示:MissingMethodException: Cannot find the requested method. 估计是破解U3D造成的,该破解文件可能是不支持WIN7下的…… 解决方法: 1、换正版。 2、换个破解文件。 5.平台编译错误或库引用缺失 错误提示:error CS1061: Type `System.IO.FileInfo' does not contain a definition for `Delete' and no extension method `Delete' of type `System.IO.FileInfo' could be found (are you missing a using directive or an assembly reference?) 出了这个错误一般有两个原因了。 1.没有引用相关的库。 2.选错编译平台。(BuildSetting里面的Platform) 错误提示:Could not start compilationWin32Exception:ApplicationName="XXXX\mono.exe",…… 解决方式:重装UNITY3D。 6.内存资源加载错误问题 错误提示:Trying to reload asset from disk that is not stored on disk 个人是在加载多个ASSETBUNDLE时,用了释放镜像之后,发生了下面的BUG。 这个警告它并没有对游戏流程有任何影响,不过一直跳出来很烦人。我们项目中是因为用Dictionary删除的时候没有删除完整导致的。 解决方案参考:http://blog.sina.com.cn/s/blog_5b6cb95001019ipi.html 个人认为比较大可能是下面的原因: 还没释放完镜像再次加载就出BUG了。将所有ASSETBUNDLE加载完后再同一释放,这样就没问题了。 Unity will only allow you to have a single instance of a particular AssetBundle loaded at one time in your application. What this means is that you can't retrieve an AssetBundle from a WWW object if the same one has been loaded previously and has not been unloaded. In practical terms it means that when you try to access a previously loaded AssetBundle like this: (BY :http://docs.unity3d.com/Documentation/Manual/keepingtrackofloadedassetbundles.html) 查阅了一下,貌似还有别的问题能导致这提示。下面是相关可以继续深入的资料,可以帮助大家理解U3D的加载和内存管理: 百度搜一下下面两篇文章,应该是出自圣典论坛: 1.【全面理解Unity加载和内存管理】 2.【全面理解Unity加载和内存管理机制之二:进一步深入和细节】 国外论坛的讨论: http://forum.unity3d.com/threads/49298-Trying-to-reload-asset-from-disk-that-is-not-stored-on-disk 貌似老外也没完全确切搞定这个。 错误提示:Deleting persistent object without writing it first 不论如何你都不应该直接修改一个从assetbundle加载进来的最初数据,一般都要先实例化出来再对其修改。但是引用的东西(例如mesh),这些也不能修改它。若要修改的话,则先复制一份出来。 //复制一份模型出来重新复制,以免直接修改被引用的镜像模型。如下: Mesh temp = Mesh.Instantiate(smr.sharedMesh) as Mesh; myMesh.sharedMesh = temp; 7.时间错误、NaN错误 错误提示:transform.position assign attempt for 'XXX' is not valid。Input rotation is {NaN, NaN, NaN, NaN}. 一般是由于游戏暂停将timescale设为0引起的,需要寻找相应用了Time.deltTime等参数的函数修改。否则会导致计算出错报空异常。 详细解决看另一篇文章: 关于NaN(Not a Number)的问题 http://blog.sina.com.cn/s/blog_5b6cb9500101cd9e.html 8.动画错误 这个错误是4.0新引进动画系统才出现的。 错误提示:Mecanim: BindSkeleton: Cannot find transform"objectname" 解决方式: 1.找到该对应transform"objectname"的模型,直接在检索面板搜索所有相应名字,能容易找到。 2.将模型的面板的Rig部分的动画AnimationType改为none 9.坐标系向量计算的错误提示 错误提示:Look rotation viewing vector is zero 解决方式:一般是由于摄像机的旋转角度造成的。也可能是向量的计算多余而系统提示。我们项目中是强制摄像机90度的时候出现,改成89.9度就没问题了。 具体还有的参考U3D官方论坛: http://answers.unity3d.com/questions/397425/look-rotation-viewing-vector-is-zero-error.html 若没找到解决方法再搜索下。 10.关于AssetServer 错误:明明上传了所有修改,但是别人的机子却没有下载带最新代码。 原因:Merge完代码之后,操作了ignore server change,UNITY默认是以你本机子的为准,若此代码没有再次修改,则AssetServer不认为这个东西被修改过,没有上传那代码。 解决方式:打个空格重新保存一下该代码。 11.关于数据格式的错误 错误提示:Illegal JSON sequence 解决方式: http://forum.unity3d.com/threads/143168-JsonFX-WTF-Illegal-JSON-sequence 12.导出WINDOS平台下的项目运行不成功 错误提示:没有找到相应assetbundle的路径 解决方式:因为用了assetbundle加载,而游戏在有中文路径下,assetbundle的路径不能有中文。换个无中文的目录即可。从根源上能解决的方案现在暂时没有。 13.导入资源出错 错误提示:Error while importing package :Couldn't decompress package 解决方式:导入资源出错,大部分都是中文路径惹的祸。将资源换到无中文路径试试。如C/D盘根目录。 |
手机版|VR开发网
统计
津ICP备18009691号
网安备12019202000257
GMT+8, 2023-3-25 07:05 PM