diff --git a/EditorPreview/Editor/LightupdaterPreview.cs b/EditorPreview/Editor/LightupdaterPreview.cs index e24f677..f0ead61 100644 --- a/EditorPreview/Editor/LightupdaterPreview.cs +++ b/EditorPreview/Editor/LightupdaterPreview.cs @@ -85,7 +85,7 @@ public static class LightUpdaterPreview static void PushFromBehaviour(LightUpdater src) { - int max = Mathf.Max(1, src.maxLights); + int max = Mathf.Max(1, LightUpdater.maxLights); EnsureArrays(src, max); var c = _cache[src]; diff --git a/EditorPreview/LightUpdater.Editor.cs b/EditorPreview/LightUpdater.Editor.cs index 4e6a036..a151899 100644 --- a/EditorPreview/LightUpdater.Editor.cs +++ b/EditorPreview/LightUpdater.Editor.cs @@ -1,5 +1,5 @@ // Assets/Lighting/Scripts/LightUpdater.Editor.cs -#if UNITY_EDITOR +#if !COMPILER_UDONSHARP && UNITY_EDITOR using UnityEngine; public partial class LightUpdater diff --git a/Scripts/LightUpdater.cs b/Scripts/LightUpdater.cs index df0f2f7..4ab7796 100644 --- a/Scripts/LightUpdater.cs +++ b/Scripts/LightUpdater.cs @@ -47,9 +47,9 @@ public partial class LightUpdater : UdonSharpBehaviour [Tooltip("float array: shadow map index (0=none, 1-4=shadow map index)")] public string shadowMapIndexProperty = "_Udon_ShadowMapIndex"; - [Header("Max Lights (advanced users)")] + [Header("Max Lighetts (advanced users)")] [Tooltip("Hard cap / array size. 80 = default cap")] - public int maxLights = 80; + public const int maxLights = 80; @@ -66,7 +66,7 @@ public partial class LightUpdater : UdonSharpBehaviour private float[] _ShadowMapArray; private bool _ShadowMap_isDirty = false; - private LightdataStorage[] _sceneLights; + private LightdataStorage[] _sceneLights = new LightdataStorage[maxLights]; private int _sceneLightCount = 0; private VRCPlayerApi[] _players; @@ -85,14 +85,12 @@ public partial class LightUpdater : UdonSharpBehaviour void Start() { - if (maxLights < 1) maxLights = 1; _positions = new Vector4[maxLights]; _lightColors = new Vector4[maxLights]; _directions = new Vector4[maxLights]; _TypeArray = new float[maxLights]; _ShadowMapArray = new float[maxLights]; - _sceneLights = new LightdataStorage[maxLights]; _players = new VRCPlayerApi[maxLights]; diff --git a/Shader/Includes/Moonlight.hlsl.meta b/Shader/Includes/Moonlight.hlsl.meta new file mode 100644 index 0000000..c566c5a --- /dev/null +++ b/Shader/Includes/Moonlight.hlsl.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 1193ddffee5ac344ea57d621ec8150f6 +ShaderIncludeImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: