Skip to content

Commit

Permalink
fix duplicated shaders
Browse files Browse the repository at this point in the history
  • Loading branch information
LazyDuchess committed Jun 29, 2024
1 parent 8f28284 commit 0574df3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 72 deletions.
11 changes: 9 additions & 2 deletions Assets/Editor/OpenTS2/ShaderBuildPreProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,20 @@ public void OnPreprocessBuild(BuildReport report)
foreach (var shaderPath in allshaders)
{
var shader = AssetDatabase.LoadAssetAtPath<Shader>(shaderPath);
if (shader == null) continue;
if (shader == null)
continue;
var alreadyInList = false;
for (var i = 0; i < alwaysIncludedShadersProp.arraySize; i++)
{
var elem = alwaysIncludedShadersProp.GetArrayElementAtIndex(i);
if (elem.objectReferenceValue == shader)
continue;
{
alreadyInList = true;
break;
}
}
if (alreadyInList)
continue;
alwaysIncludedShadersProp.InsertArrayElementAtIndex(0);
var arrayElem = alwaysIncludedShadersProp.GetArrayElementAtIndex(0);
arrayElem.objectReferenceValue = shader;
Expand Down
70 changes: 0 additions & 70 deletions ProjectSettings/GraphicsSettings.asset

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 0574df3

Please sign in to comment.