From f7eac0a34f07767dc04e035f97179cc30935284f Mon Sep 17 00:00:00 2001 From: mob-sakai Date: Wed, 28 Oct 2020 12:18:39 +0900 Subject: [PATCH] fix: in rare cases, an IndexOutOfRangeException is thrown --- Scripts/UIParticle.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Scripts/UIParticle.cs b/Scripts/UIParticle.cs index 3cdf3c2..edf24b5 100755 --- a/Scripts/UIParticle.cs +++ b/Scripts/UIParticle.cs @@ -256,6 +256,7 @@ protected override void UpdateMaterial() // Main var index = i * 2; + if (activeMeshIndices.Count <= index) break; if (activeMeshIndices[index] && 0 < s_TempMaterials.Count) { var mat = GetModifiedMaterial(s_TempMaterials[0], ps.GetTextureForSprite()); @@ -266,7 +267,7 @@ protected override void UpdateMaterial() // Trails index++; - if (materialCount <= j) break; + if (activeMeshIndices.Count <= index || materialCount <= j) break; if (activeMeshIndices[index] && 1 < s_TempMaterials.Count) { var mat = GetModifiedMaterial(s_TempMaterials[1], null);