Grobber
2
Q:

how to change the color of an object in unity c# rgb

using UnityEngine; 
using System.Collections; 

public class collisionpill : MonoBehaviour 
{      
  	public Color mycolor;       
  	
  	void OnCollisionEnter(Collision other) 
    {         
        if (other.transform.tag == "Pill") 
        {             
        	gameObject.GetComponent<Renderer>().material.color = mycolor;
        }    
    }
}
1
             void Update ()
             {                         
               if(Input.GetKeyDown(KeyCode.R))
               {                                 
                 gameObject.GetComponent<Renderer>().material.color = new Color(233, 79, 55);
               }             
             } 
-1

New to Communities?

Join the community