场景加载时崩溃 - java.lang.ClassCastException

发布于 2024-11-30 05:30:36 字数 1073 浏览 3 评论 0原文

我相信以下错误是我的许多文件中某个地方的某个变量,它是像 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

浸婚纱 2024-12-07 05:30:36

您的用户或应用程序首选项中似乎有一个条目包含浮点值,但 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文