change olour in unity script

SpriteRenderer sr;

void Start()
{
	sr = GetComponent<SpriteRenderer>();
}
void Update()
{
	//This is a simple way of adding color
	sr.color = Color.red;
	//This is a more specific way of adding color
    sr.color = new Color(0/*Red*/,0/*Green*/,0/*Blue*/)
}

Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
unity c# set color change the color of gameobject unity unity change torchmat color Unity shader change color set the color of an object uinty how to change color in unity c# unity set color of gameobject change color unity script Unity changes colour value of material unity change emmisionrate with script c# unity gameobject color use colour of sprite unity change color of sprite unity how to change sprite color in unity unity gameObject change color unity set #color in script unity 2d how to change sprite colours change color properties of sprite unity change material color unity set colors unity appi color change in unity c# color change in unity c set material color unity unity change color of object in script Change values in another script Unity how to change the color of a gameobject in unity through code unity change gameobject color how to use setcolor unity change colour unity change color unity unity color modifier component how to change material color in unity c# unity setColor function colour cahnge unity change object color by code unity how to change shader color unity unity color change script how to change color in unity in script unity color change unity set color how to change color of material in unity Unity scripting change color how to use setColors in unity change unity color how to change the colour of a material through script in unity unity how to modify unity.color.a in script change object color unity c# unity change material color unity change color unity set color of texturte2d changing color unity change olour in unity script
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source