Added Unity project files

This commit is contained in:
2026-06-07 16:58:24 +01:00
parent 3cc05d260b
commit 23bbcab156
3942 changed files with 453676 additions and 0 deletions

View File

@ -0,0 +1,46 @@
using UnityEditor;
using UnityEngine;
namespace VRC.SDK3.Editor
{
[InitializeOnLoad]
internal static class VRCUndoPostProcessor
{
private const string ShaderField = "m_Shader";
private const string FallbackTag = "VRCFallback";
static VRCUndoPostProcessor()
{
Undo.postprocessModifications += HandleUndoPostProcess;
}
private static UndoPropertyModification[] HandleUndoPostProcess(UndoPropertyModification[] modifications)
{
foreach (UndoPropertyModification modification in modifications)
{
PropertyModification propertyMod = modification.currentValue;
if (propertyMod.propertyPath == ShaderField)
{
Shader oldShader = modification.previousValue.objectReference as Shader;
Shader newShader = propertyMod.objectReference as Shader;
// Is the shader changing?
if (oldShader != newShader)
{
Material mat = propertyMod.target as Material;
if (mat == null)
{
continue;
}
// Clear VRCFallback as the shader changes. This attempts to avoid override tags set by community
// tooling "bleeding over" into shaders they don't control when the user swaps over directly.
mat.SetOverrideTag(FallbackTag, string.Empty);
}
}
}
return modifications;
}
}
}