我的错误是这样的:
“Volund/标准字符(镜面)”中的着色器错误:Assets/Features/Shared/Volund_UnityStandardCore.cginc(261) 处的下标“boxMax”无效(在 d3d11 上)
使用 DIRECTIONAL _NORMALMAP _SPECGLOSSMAP 编译 Vertex 程序
平台定义:UNITY_NO_DXT5nm UNITY_ENABLE_REFLECTION_BUFFERS UNITY_NO_SCREENSPACE_SHADOWS UNITY_PBS_USE_BRDf2 SHADER_API_DESKTOP UNITY_HARDWARE_TIER3 UNITY_COLORSPACE_GAMMA
我粘贴了上面的完整错误,请务必查看。
下面是我的着色器代码:
d.boxMax[0] = unity_SpecCube0_BoxMax;
d.boxMin[0] = unity_SpecCube0_BoxMin;
d.probePosition[0] = unity_SpecCube0_ProbePosition;
d.probeHDR[0] = unity_SpecCube0_HDR;
d.boxMax[1] = unity_SpecCube1_BoxMax;
d.boxMin[1] = unity_SpecCube1_BoxMin;
d.probePosition[1] = unity_SpecCube1_ProbePosition;
d.probeHDR[1] = unity_SpecCube1_HDR;
现在我把它改成了这样
#if UNITY_SPECCUBE_BLENDING || UNITY_SPECCUBE_BOX_PROJECTION
d.boxMin[0] = unity_SpecCube0_BoxMin;
d.boxMin[1] = unity_SpecCube1_BoxMin;
#endif
#if UNITY_SPECCUBE_BOX_PROJECTION
d.boxMax[0] = unity_SpecCube0_BoxMax;
d.boxMax[1] = unity_SpecCube1_BoxMax;
d.probePosition[0] = unity_SpecCube0_ProbePosition;
d.probePosition[1] = unity_SpecCube1_ProbePosition;
现在错误:变量 d 在未完全初始化的情况下使用。
我的问题是我成功地将 .exe 应用程序转换为 .apk 应用程序,但是当我在设备上打开它时,它只是一个黑屏,并且在我构建它后显示上面的错误。可能是什么问题呢?因为我推测上面的错误是原因。
我只是想分享我在这里所做的事情
UnityGIInput d;
UNITY_INITIALIZE_OUTPUT(UnityGIInput, d);
d.light = light;
d.worldPos = posWorld;
d.worldViewDir = -eyeVec;
d.atten = atten;
#if defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON)
d.ambient = 0;
d.lightmapUV = i_ambientOrLightmapUV;
#else
d.ambient = i_ambientOrLightmapUV.rgb;
d.lightmapUV = 0;
#endif
#if UNITY_SPECCUBE_BLENDING || UNITY_SPECCUBE_BOX_PROJECTION
d.boxMin[0] = unity_SpecCube0_BoxMin; // .w holds lerp value for blending
#endif
#if UNITY_SPECCUBE_BOX_PROJECTION
d.boxMax[0] = unity_SpecCube0_BoxMax;
d.probePosition[0] = unity_SpecCube0_ProbePosition;
d.boxMax[1] = unity_SpecCube1_BoxMax;
d.boxMin[1] = unity_SpecCube1_BoxMin;
d.probePosition[1] = unity_SpecCube1_ProbePosition;
#endif
干得好,兄弟。完全解决我的问题,给我很大帮助。谢谢。