Changing color of part of an object

Hello,

I want to change the color of just a part of my object, is it possible?

I got a standart white cube gameobject from Unity, and a transparent bigger cube with “IsTrigger” checked on its BoxCollider. What I want to do is change the color of the white cube to another one, but just in the section that entered the other cube’s collider.

I made a quick sketch in Paint that exemplifies what I’m trying to do:

How can I make that in Unity?

Woh! Right off this is definitely not a beginner’s problem.
That said, you might want to try these two methods:

  1. Use a shader which can store masking properties and mask the gameobject with different color when it enters the trigger.

  2. This is one is definitely interesting, try two materials on the gameobject and ‘lerp’ the transparency of one of them. This will look as if it’s revealing the texture underneath.

That’s as far as I can go on it. Hopefully someone can elaborate on this.