On Android the hardcoded path is not found and the code execution stops there because of NullPointerException in the Material constructor

pull/413/head
Claudiu 2018-06-26 21:15:42 +02:00
parent d3fc02c475
commit 62990e2901
1 changed files with 7 additions and 4 deletions

View File

@ -70,11 +70,14 @@ namespace UnityEngine.UI.Extensions
if (pRenderer != null) if (pRenderer != null)
pRenderer.enabled = false; pRenderer.enabled = false;
Shader foundShader = Shader.Find("UI Extensions/Particles/Additive");
Material pMaterial = new Material(foundShader);
if (material == null) if (material == null)
material = pMaterial; {
var foundShader = Shader.Find("UI Extensions/Particles/Additive");
if (foundShader)
{
material = new Material(foundShader);
}
}
currentMaterial = material; currentMaterial = material;
if (currentMaterial && currentMaterial.HasProperty("_MainTex")) if (currentMaterial && currentMaterial.HasProperty("_MainTex"))