UI Button Change Mesh; UI Button Change Color or Material

I’m trying to understand the logic of the script linked to UI buttons. I should make a first script that would help a button to change the meshes of the same game object; the second script should instead allow the button to vary the color or the material of the reference mesh. Can anyone help me?

Are you trying to make one button have interchangeable functionality?

If so, all you need to do is in a script, get a reference to the Button script and add/remove ‘listeners’ - methods that get called when the button is pressed

    myButton.onCick.AddListener(()  => someScriptReference.CertainFunction() );
    myButton.onCick.RemoveListener(()  => someScriptReference.CertainFunction() );

If the method is in the script that you are calling this from, substitute ‘this’ for someScriptReference.

I just figured this out a few hours ago, hope it helps.