在Unity Crashes中新建APK

时间:2018-01-09 04:05:08

标签: c# android opengl-es shader

在我的logcat上,错误显示

version 100
01-09 11:34:55.899 23467-23515/? D/Unity: #ifndef SHADER_TARGET
01-09 11:34:55.899 23467-23515/? D/Unity: #define SHADER_TARGET 30
01-09 11:34:55.899 23467-23515/? D/Unity: #endif
01-09 11:34:55.899 23467-23515/? D/Unity: #ifndef UNITY_NO_DXT5nm
01-09 11:34:55.899 23467-23515/? D/Unity: #define UNITY_NO_DXT5nm 1
01-09 11:34:55.899 23467-23515/? D/Unity: #endif
01-09 11:34:55.899 23467-23515/? D/Unity: #ifndef UNITY_NO_RGBM
01-09 11:34:55.899 23467-23515/? D/Unity: #define UNITY_NO_RGBM 1
01-09 11:34:55.899 23467-23515/? D/Unity: #endif
01-09 11:34:55.899 23467-23515/? D/Unity: #ifndef 
     UNITY_ENABLE_REFLECTION_BUFFERS
01-09 11:34:55.899 23467-23515/? D/Unity: #define 
     UNITY_ENABLE_REFLECTION_BUFFERS 1
01-09 11:34:55.899 23467-23515/? D/Unity: #endif
01-09 11:34:55.899 23467-23515/? D/Unity: #ifndef 
     UNITY_FRAMEBUFFER_FETCH_AVAILABLE
01-09 11:34:55.899 23467-23515/? D/Unity: #define 
     UNITY_FRAMEBUFFER_FETCH_AVAILABLE 1
01-09 11:34:55.899 23467-23515/? D/Unity: #endif
01-09 11:34:55.899 23467-23515/? D/Unity: #ifndef         UNITY_NO_SCREENSPACE_SHADOWS
01-09 11:34:55.899 23467-23515/? D/Unity: #define     UNITY_NO_SCREENSPACE_SHADOWS 1
01-09 11:34:55.899 23467-23515/? D/Unity: #endif
01-09 11:34:55.899 23467-23515/? D/Unity: #ifndef UNITY_PBS_USE_BRDF2
01-09 11:34:55.899 23467-23515/? D/Unity: #define UNITY_PBS_USE_BRDF2 1
01-09 11:34:55.899 23467-23515/? D/Unity: #endif
01-09 11:34:55.899 23467-23515/? D/Unity: #ifndef SHADER_API_MOBILE
01-09 11:34:55.899 23467-23515/? D/Unity: #define SHADER_API_MOBILE 1
01-09 11:34:55.899 23467-23515/? D/Unity: #endif
01-09 11:34:55.899 23467-23515/? D/Unity: #ifndef UNITY_HARDWARE_TIER2
01-09 11:34:55.899 23467-23515/? D/Unity: #define UNITY_HARDWARE_TIER2 1
01-09 11:34:55.899 23467-23515/? D/Unity: #endif
01-09 11:34:55.899 23467-23515/? D/Unity: #ifndef UNITY_COLORSPACE_GAMMA
01-09 11:34:55.899 23467-23515/? D/Unity: #define UNITY_COLORSPACE_GAMMA 1
01-09 11:34:55.899 23467-23515/? D/Unity: #endif
01-09 11:34:55.899 23467-23515/? D/Unity: #ifndef UNITY_VERSION
01-09 11:34:55.899 23467-23515/? D/Unity: #define UNITY_VERSION 561
01-09 11:34:55.899 23467-23515/? D/Unity: #endif
01-09 11:34:55.899 23467-23515/? D/Unity: #ifndef SHADER_STAGE_VERTEX
01-09 11:34:55.899 23467-23515/? D/Unity: #define SHADER_STAGE_VERTEX 1
01-09 11:34:55.899 23467-23515/? D/Unity: #endif
01-09 11:34:55.899 23467-23515/? D/Unity: #ifndef SHADER_API_GLES
01-09 11:34:55.899 23467-23515/? D/Unity: #define SHADER_API_GLES 1
01-09 11:34:55.899 23467-23515/? D/Unity: #endif
01-09 11:34:55.899 23467-23515/? D/Unity: #define gl_Vertex _glesVertex
01-09 11:34:55.899 23467-23515/? D/Unity: attribute vec4 _glesVertex;
01-09 11:34:55.899 23467-23515/? D/Unity: #define gl_MultiTexCoord0 _glesMultiTexCoord0
01-09 11:34:55.899 23467-23515/? D/Unity: attribute vec4     _glesMultiTexCoord0;
01-09 11:34:55.899 23467-23515/? D/Unity: #line 440
01-09 11:34:55.899 23467-23515/? D/Unity: struct v2f_vertex_lit {
01-09 11:34:55.899 23467-23515/? D/Unity:     highp vec2 uv;
01-09 11:34:55.899 23467-23515/? D/Unity:     lowp vec4 diff;
01-09 11:34:55.899 23467-23515/? D/Unity:     lowp vec4 spec;
01-09 11:34:55.899 23467-23515/? D/Unity: };
01-09 11:34:55.899 23467-23515/? D/Unity: #line 728
01-09 11:34:55.899 23467-23515/? D/Unity: struct v2f_img {
01-09 11:34:55.899 23467-23515/? D/Unity:     highp vec4 pos;
01-09 11:34:55.899 23467-23515/? D/Unity:     mediump vec2 uv;
01-09 11:34:55.899 23467-23515/? D/Unity: };
01-09 11:34:55.899 23467-23515/? D/Unity: #line 722
01-09 11:34:55.899 23467-23515/? D/Unity: struct appdata_img {
01-09 11:34:55.899 23467-23515/? D/Unity:     highp vec4 vertex;
01-09 11:34:55.899 23467-23515/? D/Unity:     mediump vec2 texcoord;
01-09 11:34:55.899 23467-23515/? D/Unity: };
01-09 11:34:55.899 23467-23515/? D/Unity: #line 20
01-09 11:34:55.899 23467-23515/? D/Unity: struct v2f {
01-09 11:34:55.899 23467-23515/? D/Unity:     highp vec4 pos;
01-09 11:34:55.899 23467-23515/? D/Unity:     mediump vec2 uv;
01-09 11:34:55.899 23467-23515/? D/Unity: };

而且时间太长了。它看起来像着色器代码。

我使用的设备是三星Galaxy S7。 在模拟器上,它运行得非常好。任何想知道发生了什么以及为什么着色器代码出现在我的logcat上的人。

顺便说一句,我的代码就是我的 BuildEditor.cs 因为我猜它会影响崩溃?

//Setup Graphics for Android only!
QualitySettings.antiAliasing = 0;
Application.targetFrameRate = 30;
QualitySettings.vSyncCount = 0;

if(qualityLevel == 0){
    QualitySettings.shadowCascades = 0;
    QualitySettings.shadowDistance = 15;
} else if(qualityLevel == 5){
    QualitySettings.shadowCascades = 2;
    QualitySettings.shadowDistance = 50;
}
Screen.sleepTimeout = SleepTimeout.NeverSleep;
是不是?

1 个答案:

答案 0 :(得分:0)

我发现在我的设备上使用OpenGl es 2.0会让我的新构建版本崩溃,所以不使用opengl es 2.0而是使用了opengl es 3.0,它现在运行正常。