Color changing game

Hello there! I am new to unity and i am working on a somewhat ambivious project for a first time game developer. In my game there are items that i need to collect, sort of coins, and as i catch them i want the world to gain collor.
So, the world would start in black and white and then, as we go and collect “coins” i t starts having some color.

Does anyone have any idea of how to do this?

2 Answers

2

Good evening,

So, if different objects need to be colorized, you could try to access the SpriteRenderer via an script.
Just refer the gameObject in the script or the component <SpriteRenderer> directly and set the color with:

(gameObject).GetComponent< SpriteRenderer >().SetColor(R,G,B,A)

A in this case is for transparency

if you want ot intensify the hole screen with color, you can also try to work with panel
hope this works for you!

This really depends on how you want this to work. A really simple solution would be to add a global volume with a color adjustment override where you turn the saturation all the way down, slowly increasing it when collecting coins.

However since volumes are post processing you can’t selectively exclude objects this way. For that maybe take a look at Custom Render Passes (HDRP) or Render Features (URP).