场景加载时崩溃 - java.lang.ClassCastException
我相信以下错误是我的许多文件中某个地方的某个变量,它是像 int 或类似的东西一样使用的浮点数:
java.lang.ClassCastException: java.lang.Float
但是对于我的一生,我无法找到发生这种情况的位置,调试了所有内容,也许下面的信息可以让比我聪明得多的人弄清真相。我正在使用 Unity,崩溃发生在场景中的所有内容加载后。
如果您需要更多信息,请告诉我。
从日志猫:
W/dalvikvm( 3999): threadid=9: thread exiting with uncaught exception (group=0x40015560)
E/AndroidRuntime( 3999): FATAL EXCEPTION: GLThread 10
E/AndroidRuntime( 3999): java.lang.ClassCastException: java.lang.Float
E/AndroidRuntime( 3999): at android.app.ContextImpl$SharedPreferencesImpl.getInt(ContextImpl.java:2833)
E/AndroidRuntime( 3999): at com.unity3d.player.PlayerPrefs.GetInt(Unknown Source)
E/AndroidRuntime( 3999): at com.unity3d.player.UnityPlayer.nativeRender(Native Method)
E/AndroidRuntime( 3999): at com.unity3d.player.UnityPlayer.onDrawFrame(Unknown Source)
E/AndroidRuntime( 3999): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1363)
E/AndroidRuntime( 3999): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1118)
I believe the following error to be some variable somewhere in my many files to be a float used like a int or somthing like that:
java.lang.ClassCastException: java.lang.Float
But for the life of me, I cannot find where this happens, debugged everything, and well maybe this info below can allow someone much smarter then myself get to the bottom of it. I am using Unity and the crash happens after everything in the scene is loaded.
Let me know if you need more information.
From the logcat:
W/dalvikvm( 3999): threadid=9: thread exiting with uncaught exception (group=0x40015560)
E/AndroidRuntime( 3999): FATAL EXCEPTION: GLThread 10
E/AndroidRuntime( 3999): java.lang.ClassCastException: java.lang.Float
E/AndroidRuntime( 3999): at android.app.ContextImpl$SharedPreferencesImpl.getInt(ContextImpl.java:2833)
E/AndroidRuntime( 3999): at com.unity3d.player.PlayerPrefs.GetInt(Unknown Source)
E/AndroidRuntime( 3999): at com.unity3d.player.UnityPlayer.nativeRender(Native Method)
E/AndroidRuntime( 3999): at com.unity3d.player.UnityPlayer.onDrawFrame(Unknown Source)
E/AndroidRuntime( 3999): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1363)
E/AndroidRuntime( 3999): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1118)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的用户或应用程序首选项中似乎有一个条目包含浮点值,但 Unity 期望该条目为整数。
It looks as if there's an entry in your user or application preferences that contains a float value, but which Unity expects to be an integer.