Skip to content

Commit

Permalink
Fix shader loading on Linux (#26)
Browse files Browse the repository at this point in the history
Fixes two issues:
- Load the Linux shader assetbundle instead of the OSX version on Linux
- The new assetbundle from #24 contain files other than the shaders -
  both intended (the new .cginc files), and a few unintended ones (in a
  folder named b9, there are .obj and .mat files). For the former, fix
  the exception that occured when trying to load those files as shaders.
  For the latter, the assetbundles should be recompiled without those
  files.
  • Loading branch information
Nazfib authored Nov 8, 2024
1 parent ef86581 commit a63ab26
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Utilities/KKGraphics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ internal static void LoadShaderBundles ()
bundleFileName = "kkshaders.osx";
break;
case RuntimePlatform.LinuxPlayer:
bundleFileName = "kkshaders.osx";
bundleFileName = "kkshaders.linux";
break;
default:
bundleFileName = "kkshaders.windows";
Expand Down Expand Up @@ -106,8 +106,10 @@ internal static void LoadShaderBundles ()
private static void LoadAndRegisterShader(AssetBundle bundle , string shaderName)
{
Shader newShader = bundle.LoadAsset<Shader>(shaderName);
if (newShader == null) { return; } // This file is not a shader; ignore it.

GameObject.DontDestroyOnLoad(newShader);
if (newShader == null || !newShader.isSupported)
if (!newShader.isSupported)
{
Log.Error("could not load shader: " + shaderName + " from: " + bundle.name);
}
Expand Down

0 comments on commit a63ab26

Please sign in to comment.