From 62990e2901a104ef9cec23cd22c799e77cc6d34b Mon Sep 17 00:00:00 2001 From: Claudiu Date: Tue, 26 Jun 2018 21:15:42 +0200 Subject: [PATCH] On Android the hardcoded path is not found and the code execution stops there because of NullPointerException in the Material constructor --- Scripts/Effects/UIParticleSystem.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Scripts/Effects/UIParticleSystem.cs b/Scripts/Effects/UIParticleSystem.cs index 1f5c391..d5a3806 100644 --- a/Scripts/Effects/UIParticleSystem.cs +++ b/Scripts/Effects/UIParticleSystem.cs @@ -70,11 +70,14 @@ namespace UnityEngine.UI.Extensions if (pRenderer != null) pRenderer.enabled = false; - Shader foundShader = Shader.Find("UI Extensions/Particles/Additive"); - Material pMaterial = new Material(foundShader); - if (material == null) - material = pMaterial; + { + var foundShader = Shader.Find("UI Extensions/Particles/Additive"); + if (foundShader) + { + material = new Material(foundShader); + } + } currentMaterial = material; if (currentMaterial && currentMaterial.HasProperty("_MainTex"))