i am trying to make a game in that game character select gameobject and change shader on it with rgb please help??
You would need to get the material first with a Material variable type, then you can manipulate the attributes of said material/shader if you know the names of what you want to alter, which you can get by clicking on the material, then the little gear in the top, then “Select Shader”
Youll see the names of everything in the Inspector
So for example, if you wanted to change the base color, your code might look something like this:
//C#, untested
public Material myMat;
void Start (){
//You could also set it manually if you wanted to make 'myMat' private, and not set it in the inspector:
//myMat = gameObject.GetCompoment<Material>();
//Set the color of the material, seen in the inspector
myMat.SetColor("_Color",new Color(1f,0.5f,1f)); //Set the color to full RED, half GREEN, full BLUE
//If you wanted, you could also add another parameter for the alpha, otherwise its defaulted at 100%
myMat.SetFloat("_Glossiness", 0.75f); //This is just an example for changing the Glossiness, which is the "Specular" variable I believe... Its the difference that because Glossiness is a float variable, between 0 and 1, "SetFloat" is used and expects a float, whereas Color is an actual RGB color, "SetColor" is used and expects a color
}
General idea…