Exactly same question has been answered in the Default Room
Copying collider material to another game object - SteamVR
HI, I would like to start by pointing out that I am not a complete newbie to programming, but I am only learning C# for the second day. I programmed my first simple game (snake :) ) in Turbo Pascal in high school, and one (maze) in unity years ago using JS. Now I'm creating a virtual showroom using SteamVR and need to use interactive elements. One of them is a color palette made up of a mesh object. I'm using custom sphere to pick color from each part of the palette (19 colors in total). The idea is that the sphere touches a material on the palette and that material is immediately displayed on the desired object (in my case lift cladding). I understand roughly how C# works, but I am unable to effectively track down the correct functions. I am using HDRP. Script should be attached to the sphere, but I was also considering attaching it to palette meshes. So far I ended up with this:
 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 
 public class ChangeCladdingMaterial : MonoBehaviour
 {
     public GameObject liftCladding;
     public Material material;
     Renderer rend;
 
     void Start()
     {
         rend = GetComponent<Renderer>();
         rend.enabled = true;
         rend.sharedMaterial = material;
     }
 
     void OnTriggerEnter(Collider coll)
     {
         if (coll.gameObject.tag == "Palette")
         {
          // first I was thinking something like this could work:
          // rend = liftCladding.material._BaseColor = ???;
 
          // or something like this:
          // liftCladding.material.SetColor("_Color", ???);
          
         }
     }
Thanks for anybodys help by pointing me into the right direction.
 koobas.hobune.stream
koobas.hobune.stream 
                       
               
 
			 
                