Unable to change Shader Variant Limit

So I’m having an odd issue. (HDRP) My shader variant limit on project settings is fixed at 128 and I am unable to change it. This shows up on console whenever I try:

NullReferenceException: Object reference not set to an instance of an object
UnityEditor.ShaderGraph.ShaderGraphProjectSettingsProvider.OnGUIHandler (System.String searchContext) (at ./Library/PackageCache/com.unity.shadergraph@14.0.10/Editor/ShaderGraphProjectSettings.cs:68)
UnityEditor.SettingsProvider.OnGUI (System.String searchContext) (at <8e887700cd7e4674989da7b046e8eaa6>:0)
UnityEditor.SettingsWindow.DrawControls () (at <8e887700cd7e4674989da7b046e8eaa6>:0)
UnityEditor.SettingsWindow.DrawSettingsPanel () (at <8e887700cd7e4674989da7b046e8eaa6>:0)
UnityEngine.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, UnityEngine.Matrix4x4 parentTransform, UnityEngine.Rect clippingRect, System.Boolean isComputingLayout, UnityEngine.Rect layoutSize, System.Action onGUIHandler, System.Boolean canAffectFocus) (at <65dd26f13aa64a8aa867b0c3ce21500d>:0)
UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect, System.Action onGUIHandler, System.Boolean canAffectFocus) (at <65dd26f13aa64a8aa867b0c3ce21500d>:0)
UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, System.Action onGUIHandler, System.Boolean canAffectFocus) (at <65dd26f13aa64a8aa867b0c3ce21500d>:0)
UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, System.Boolean canAffectFocus) (at <65dd26f13aa64a8aa867b0c3ce21500d>:0)
UnityEngine.UIElements.IMGUIContainer.SendEventToIMGUIRaw (UnityEngine.UIElements.EventBase evt, System.Boolean canAffectFocus, System.Boolean verifyBounds) (at <65dd26f13aa64a8aa867b0c3ce21500d>:0)
UnityEngine.UIElements.IMGUIContainer.SendEventToIMGUI (UnityEngine.UIElements.EventBase evt, System.Boolean canAffectFocus, System.Boolean verifyBounds) (at <65dd26f13aa64a8aa867b0c3ce21500d>:0)
UnityEngine.UIElements.IMGUIContainer.ProcessEvent (UnityEngine.UIElements.EventBase evt) (at <65dd26f13aa64a8aa867b0c3ce21500d>:0)
UnityEngine.UIElements.CallbackEventHandler.HandleEvent (UnityEngine.UIElements.EventBase evt) (at <65dd26f13aa64a8aa867b0c3ce21500d>:0)
UnityEngine.UIElements.CallbackEventHandler.HandleEventAtCurrentTargetAndPhase (UnityEngine.UIElements.EventBase evt) (at <65dd26f13aa64a8aa867b0c3ce21500d>:0)
UnityEngine.UIElements.CallbackEventHandler.HandleEventAtTargetPhase (UnityEngine.UIElements.EventBase evt) (at <65dd26f13aa64a8aa867b0c3ce21500d>:0)
UnityEngine.UIElements.MouseCaptureDispatchingStrategy.DispatchEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at <65dd26f13aa64a8aa867b0c3ce21500d>:0)
UnityEngine.UIElements.EventDispatcher.ApplyDispatchingStrategies (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, System.Boolean imguiEventIsInitiallyUsed) (at <65dd26f13aa64a8aa867b0c3ce21500d>:0)
UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at <65dd26f13aa64a8aa867b0c3ce21500d>:0)
UnityEngine.UIElements.EventDispatcher.ProcessEventQueue () (at <65dd26f13aa64a8aa867b0c3ce21500d>:0)
UnityEngine.UIElements.EventDispatcher.OpenGate () (at <65dd26f13aa64a8aa867b0c3ce21500d>:0)
UnityEngine.UIElements.EventDispatcherGate.Dispose () (at <65dd26f13aa64a8aa867b0c3ce21500d>:0)
UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at <65dd26f13aa64a8aa867b0c3ce21500d>:0)
UnityEngine.UIElements.EventDispatcher.Dispatch (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, UnityEngine.UIElements.DispatchMode dispatchMode) (at <65dd26f13aa64a8aa867b0c3ce21500d>:0)
UnityEngine.UIElements.BaseVisualElementPanel.SendEvent (UnityEngine.UIElements.EventBase e, UnityEngine.UIElements.DispatchMode dispatchMode) (at <65dd26f13aa64a8aa867b0c3ce21500d>:0)
UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at <65dd26f13aa64a8aa867b0c3ce21500d>:0)
UnityEngine.UIElements.UIElementsUtility.UnityEngine.UIElements.IUIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& eventHandled) (at <65dd26f13aa64a8aa867b0c3ce21500d>:0)
UnityEngine.UIElements.UIEventRegistration.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at <65dd26f13aa64a8aa867b0c3ce21500d>:0)
UnityEngine.UIElements.UIEventRegistration+<>c.<.cctor>b__1_2 (System.Int32 i, System.IntPtr ptr) (at <65dd26f13aa64a8aa867b0c3ce21500d>:0)
UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& result) (at <d26551307ee24906965335845380d4a1>:0)

One possible issue I found is if the file directory has any unrecognized characters. The parent directory of the project’s file has a “-” in it. Could that be a problem? Can I just safely rename it?

1 Like

Experiencing the same exact issue right now in a URP LTS project.

I am having the same issue. I dont have a “-” in my project file name/path so i dont think that is it. I created a new project in Unity 2022.3.37 and tested this out and am having the same issue.

I am also unable to change shaderVarientLimit in the ShaderGraphSettings.asset file as it just gets reverted.

1 Like

Ok i figured this one out. You can only change the shader varient limit if a shader graph window is actually open on the screen. If not you will get an error in the console.

The shader must compile as well.

1 Like