question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Android Build not completing when including shaderRetention in build

See original GitHub issue

Shader error in 'GLTF/PbrMetallicRoughness': '' : 'UNITY_STANDARD_SIMPLE' already defined at /Program Files/Unity/Editor/Data/CGIncludes/UnityStandardCoreForward.cginc(6) (on gles)

I am using latest version of unitygltf and also I have tested all possible solution in issues regarding to this problem in unity

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:11 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
pennomicommented, Apr 9, 2018

OK I just barely figured out how to fix this issue the right way. (It looks like it’s a bug in some core Unity includes.)

First, create a new file called UnityGltfStandardCoreForward.cginc and paste in the following code:

#ifndef UNITY_STANDARD_CORE_FORWARD_INCLUDED
#define UNITY_STANDARD_CORE_FORWARD_INCLUDED

#include "UnityStandardConfig.cginc"

#if UNITY_STANDARD_SIMPLE
    #include "UnityStandardCoreForwardSimple.cginc"
    VertexOutputBaseSimple vertBase (VertexInput v) { return vertForwardBaseSimple(v); }
    VertexOutputForwardAddSimple vertAdd (VertexInput v) { return vertForwardAddSimple(v); }
    half4 fragBase (VertexOutputBaseSimple i) : SV_Target { return fragForwardBaseSimpleInternal(i); }
    half4 fragAdd (VertexOutputForwardAddSimple i) : SV_Target { return fragForwardAddSimpleInternal(i); }
#else
    #include "UnityStandardCore.cginc"
    VertexOutputForwardBase vertBase (VertexInput v) { return vertForwardBase(v); }
    VertexOutputForwardAdd vertAdd (VertexInput v) { return vertForwardAdd(v); }
    half4 fragBase (VertexOutputForwardBase i) : SV_Target { return fragForwardBaseInternal(i); }
    half4 fragAdd (VertexOutputForwardAdd i) : SV_Target { return fragForwardAddInternal(i); }
#endif

#endif // UNITY_STANDARD_CORE_FORWARD_INCLUDED

Then, in the PbrSpecularGlossiness.shader and PbrMetallicRoughness.shader files, replace all

#include "UnityStandardCoreForward.cginc"

with

#include "UnityGltfStandardCoreForward.cginc"

Let me know if this works for you guys.

0reactions
spydevelopercommented, Jul 30, 2019

Hello Guys,

Hope so you are fine and keeping well. Attached is the log of unity android build and these two shaders are taking most of the size in the app.

“58.9 mb 8.3% Assets/UnityGLTF/Shaders/PbrSpecularGlossiness.shader 55.7 mb 7.9% Assets/UnityGLTF/Shaders/PbrMetallicRoughness.shader”

When I don’t add them in the android build the build doesn’t work so I have added them and now it has increased the size. Can please anyone help me @stevenvergenz

image

Read more comments on GitHub >

github_iconTop Results From Across the Web

android - Gradle build not finished
In Android Studio go to File -> Settings -> Build, Execution, Deployment -> Build Tools -> Gradle Check the 'Offline work' under 'Global ......
Read more >
Bug - Can't build for Android
6 can't build for Android because there is a missing Tools folder inside Editor\Data\PlaybackEngines\AndroidPlayer\ so Unity can't find gradle.
Read more >
Known issues with Android Studio and Android Gradle Plugin
To fix the issue for the current project, click Run > Edit Configurations and change the default JUnit configuration to only include the...
Read more >
Troubleshoot build performance with Build Analyzer
If you haven't already done so, build your app in one of the following ways: Click Build > Make Project from the menu...
Read more >
Build your app from the command line | Android Studio
Find out how you can execute all the build tasks available to your Android project using the Gradle wrapper command line tool.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found