[Add] All in one shader

This commit is contained in:
2026-02-23 22:01:07 +07:00
parent ec0aa86ac2
commit 4f942cd7c0
806 changed files with 401510 additions and 33 deletions
@@ -0,0 +1,39 @@
#if LETAI_TRUESHADOW
using LeTai.TrueShadow;
using LeTai.TrueShadow.PluginInterfaces;
using UnityEngine;
namespace AllIn1SpriteShader
{
[ExecuteAlways]
public class TrueShadowCompatibility : MonoBehaviour, ITrueShadowCustomHashProvider
{
[Tooltip("Use with animated effects")]
public bool updateTrueShadowEveryFrame = false;
private TrueShadow shadow;
public void UpdateTrueShadow()
{
if (!shadow) shadow = GetComponent<TrueShadow>();
if (!shadow) return;
UpdateTrueShadow(shadow);
}
public static void UpdateTrueShadow(TrueShadow shadow)
{
shadow.CustomHash = Random.Range(int.MinValue, int.MaxValue);
}
public void Update()
{
bool shouldDirty = updateTrueShadowEveryFrame;
#if UNITY_EDITOR
shouldDirty |= !Application.isPlaying;
#endif
if (shouldDirty)
UpdateTrueShadow();
}
}
}
#endif