Change gameObject color based on Player movement

I’m trying to find a way to change the color of the floor based on where the player moves in a 2D space. If the player moves across the y axis, the B of RGB will increase or decrease. If the player moves along the x axis, the G of RGB will increase or decrease.

Hello @RescueSatellite

Its simple, you only need tyo change rgb colors of a texture during the update (or IEnumerator) function.

you will need to write the correct code, but it should be something like:

float Xpos = object.transform.position.x;
float Ypos = object.transform.position.Y
Object.GetComponent<Renderer>().material.color = new Color (Xpos, Ypos,0.5f);

Look that color rgb components goes from 0 to 1, so you need to adapt the position of the player to a 0 to 1 value.

This was just a orientation, you need to do it correctly and specificly for your case.