Changing Material Color in Unity

Rusben Guzman
Dec 21, 2021

--

Objective: change the color of the camera cone when the player is caught by the security cameras.

In this case I opened the security camera script and declared a variable to get the reference to the mesh renderer.

Then in the ActiveCutscene coroutine I declared a new color variable and assigned a red color. Then I used the function rendere.material.SetColor and passed the name of the property I wanted to change (in this case _TintColor) and the new color I created.

And just with those 2 lines we can see how the camera cone changes its color when the player is caught.

--

--

Rusben Guzman
Rusben Guzman

Written by Rusben Guzman

A Software Engineer passionate about game dev and interactive products with Unity. I consider video games to be the artistic expression of programming.

No responses yet