How do you change objects and materials with buttons?

Hi so i followed the switching materials tutorial and I’m able to change an objects color by clicking on it now I’m wondering how to change it with buttons/elements and I’m stuck also I’m trying to figure out how to switch between objects basically just turning off ones enabled and turning on the others I’m new to play canvas. I’ve attached a link to my project there is an error currently popping up when I’m clicking on my button to change the materials.

also i was wondering if there is a way of changing a material that is in my assets like changing the diffuse color of it so it effects all the objects that material is attached too

if you would like me to paste the code here let me know any help would be greatly appreciated.