I wanted to change the material of prefab through script

Help

Hi,

Maybe you could put a little more effort to phrasing your question?

using UnityEngine;

public class Colorpicker : MonoBehaviour
{

    public MeshRenderer enderer;
    public Material green;
    public Material red;
    public Material blue;
    public Material _default;
    public Material orange;


    // Start is called before the first frame update
    void Start()
    {
        enderer =GetComponent<MeshRenderer> ();
   

    }

    public void DefaultColor()
    {
    
    
        enderer.sharedMaterial.color = _default.color;
   
    
    }

    public void BlueColor()
    {
   
        enderer.sharedMaterial.color = blue.color;

    }

    public void RedColor()
    {

        enderer.sharedMaterial.color = red.color;

    }
    public void GreenColor()
    {

        enderer.sharedMaterial.color = green.color;

    }

    public void OrangeColor()
    {

        enderer.sharedMaterial.color = orange.color;

    }

}

this script works fine in editor(without any error). when I build my project(for android) this script doesn’t work.
It only changes the color of material.

The only code I see here is to change the material color. What else is supposed to happen? Not even sure how this code is exected.

Maybe the color change methods are called by some UI button or another other script, as they are public. But it would be better if the OP author would explain what the idea/goal is.

Did you manage to get it to work?