From f66234a558020ecf3b427f83471856882bf84949 Mon Sep 17 00:00:00 2001 From: Phantomical Date: Tue, 14 Jul 2026 20:21:44 -0700 Subject: [PATCH] Load shader asset bundles asynchronously Loading these synchronously means that you get a big stall if anything else happens to be loading asset bundles at the same time, since the sync load blocks until the existing load completes. --- Source/ShabBundleLoader.cs | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/Source/ShabBundleLoader.cs b/Source/ShabBundleLoader.cs index 140bd52..5259208 100644 --- a/Source/ShabBundleLoader.cs +++ b/Source/ShabBundleLoader.cs @@ -29,17 +29,25 @@ public class DatabaseLoaderTexture_SHAB : DatabaseLoader(); - foreach (var shader in shaders) { - Log.Debug($"adding custom shader `{shader.name}`"); - Shabby.AddShader(shader); - } + yield break; } - yield break; + var request = bundle.LoadAllAssetsAsync(); + yield return request; + + foreach (var obj in request.allAssets) { + if (obj is not Shader shader) + continue; + + Log.Debug($"adding custom shader `{shader.name}`"); + Shabby.AddShader(shader); + } } }