Does a Shader Graph Material work with Image component?

Hello friends. I’m having some trouble getting a material to work properly. It’s very possibly user error as I’m new to Shader Graph and relatively new to Unity. I’ve dug through tons of forum posts and I can’t tell if I’m doing something wrong or what. I’m using 2023.2.0b17 since it has support for Canvas shader graphs, which I thought might be the problem, but that didn’t seem to help either.

The basic idea is: I want to avoid creating a ton of button state image assets, so I’m trying to create a UI button shader that can apply an icon and updates its texture based on a Button State value. When I update the Button State default value in Shader Graph, it appears to work properly. When I enter Play mode, I can tell the button state value is being updated via script, but the material does not update in the Game view.

I’ve seen a bunch of issues where UI Canvas’ or UI elements dont work with shader graph materials (or something similar) so I’m not sure if that’s what I’m running into here or if its something else. Any help would be appreciated. I’ve tried just about every shader setting with no luck.

I’ve also seen people talk about how when you call renderer.material it makes a copy of the material instead of actually accessing the applied material and I realize that’s what the code below shows me doing. But I’ve also tried creating a new material, applying the changes to that material, then assigning it to renderer.material after each state update and that didn’t seem to help either. Also, in Play mode, I can see the material updating the button state properly but the material does not change.

I’ll share some screenshots and code snippets. I appreciate if anybody could take a look and either tell me its not possible or help me get things right. Feels like I’ve tried everything and read through tons of posts here.

Also for some reason my Sample Texture 2D nodes that take in my Icons look really messed up…not sure what that’s about but that’s not necessarily what I care about (yet) but thoughts on that would be appreciated.

imgur album of screenshots:

Button awake:

// Set initial button shader properties
if (_buttonRenderer == null) { _buttonRenderer = gameObject.GetComponent<Image>(); }
_buttonMaterial = new Material(Shader.Find("Shader Graphs/ButtonShader"));
_buttonRenderer.material = _buttonMaterial;
SetButtonTextures(Resources.Load<Texture>("UI/icnBrush"));
SetButtonState(ButtonState.Def);

Set Button State:

public void SetButtonState(ButtonState state)
        {
            if (_buttonRenderer.material != null)
            {
                _buttonState = state;
               
                _buttonRenderer.material.SetFloat("_Button_State", (float)state);
                Debug.Log("button state float: " + (float)state);
                Debug.Log("GetFloat: " + _buttonRenderer.material.GetFloat("_Button_State"));
                //setting _buttonMaterial values then assigning to _buttonRenderer.material didnt work either
                //_buttonRenderer.material = _buttonMaterial;
            }
        }

In case anybody comes across this in the future:
The Clamp nodes within Shader Graph were the issue. I removed them and everything worked properly.