Fix for IndexOutOfRangeException: Index was outside the bounds of the array

This commit is contained in:
Marllon Vilano 2024-02-19 13:34:59 -03:00
parent a8f400b9bf
commit 75a1003b8c

View File

@ -264,6 +264,10 @@ namespace Spine.Unity {
System.Action<Texture> onTextureLoaded) {
PlaceholderTextureMapping[] placeholderTextures = placeholderMap[materialIndex].textures;
if (placeholderTextures == null || textureIndex >= placeholderTextures.Length) {
return null;
}
TargetReference targetReference = placeholderTextures[textureIndex].targetTextureReference;
loadedDataAtMaterial[materialIndex].lastFrameRequested = Time.frameCount;