Player changes color on button collision in VR?,Changing player color on button collision VR?

To keep things short, I am new to coding and Unity in general.

I tried to find good tutorials, but none of them helped me out. I am currently making a “Gorilla Tag” fangame and need some assistance on changing the player’s color. I want there to be a button system, where whatever button you press, that is the color you have. Here is the code I have that doesn’t seem to want to work.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ColorChange : MonoBehaviour
{
    public Material m_Material;
    
    // Start is called before the first frame update
    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {
        void onCollisionEnter()
        {
            m_Material.color = Color.blue;
        }

    }
}

Here is also an image that could possibly help.

,Haven’t seen this on a tutorial anywhere, so I’m asking here.

I am making a “Gorilla Tag” fangame in VR. I have used Unity before, but this is my first time coming back to it in a long time. I don’t know how to code well, so that may be part of the problem for I usually use Unreal Engine. How would I make it to where I can press a trigger button and be able to change my player’s material color? Here’s what I am going with so far but it doesn’t seem to work.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ColorChange : MonoBehaviour
{
    public Material m_Material;
    
    // Start is called before the first frame update
    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {
        void onCollisionEnter()
        {
            m_Material.color = Color.blue;
        }

    }
}

You need to set the material to the MeshRenderer.

public GameObject obj; //set in inspector, must have MeshRenderer
MeshRenderer objMesh;
void Start()
{
    objMesh = obj.GetComponent<MeshRenderer>();
}
void Update()
{
    void onCollisionEnter()
    {
        m_Material.color = Color.blue;
        obj.material = m_Material;
    }
}

196044-screenshot-2022-05-07-123358.png
These are the four errors I am getting from this, I don’t understand how to fix it. Could you explain how to fix it?
@rh_galaxy