From 75a1003b8c61ae369859d625b7c91b93afc8a59d Mon Sep 17 00:00:00 2001 From: Marllon Vilano Date: Mon, 19 Feb 2024 13:34:59 -0300 Subject: [PATCH] Fix for IndexOutOfRangeException: Index was outside the bounds of the array --- .../Runtime/GenericOnDemandTextureLoader.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/spine-unity/Modules/com.esotericsoftware.spine.on-demand-loading/Runtime/GenericOnDemandTextureLoader.cs b/spine-unity/Modules/com.esotericsoftware.spine.on-demand-loading/Runtime/GenericOnDemandTextureLoader.cs index 95e33ce19..1f9207fe0 100644 --- a/spine-unity/Modules/com.esotericsoftware.spine.on-demand-loading/Runtime/GenericOnDemandTextureLoader.cs +++ b/spine-unity/Modules/com.esotericsoftware.spine.on-demand-loading/Runtime/GenericOnDemandTextureLoader.cs @@ -264,6 +264,10 @@ namespace Spine.Unity { System.Action onTextureLoaded) { PlaceholderTextureMapping[] placeholderTextures = placeholderMap[materialIndex].textures; + if (placeholderTextures == null || textureIndex >= placeholderTextures.Length) { + return null; + } + TargetReference targetReference = placeholderTextures[textureIndex].targetTextureReference; loadedDataAtMaterial[materialIndex].lastFrameRequested = Time.frameCount;