I
I
Ilya_malet2021-11-03 10:31:05
Unity
Ilya_malet, 2021-11-03 10:31:05

How to make color dependent on distance?

Hello, help to implement color dependence on distance. I have 2 objects, one of them is a player, and the second is an enemy, the enemy moves towards the player without reaching him at a distance indicated in the field. By default, the color of the enemy is black, but I need to make the color depend on the distance (the distance is also calculated and stored in a variable). That is, there are 2 variables of float type (the values ​​​​can be neglected in principle, but we will agree that their values ​​​​are equal to 10 and 100) where 100 should be completely black, and where 10 should be completely violet).

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
freeExec, 2021-11-03
@Ilya_malet

Color.Lerp

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question