Change color on collision and keep track?

So, I’m making a 3D platform based on the idea of color. The platforms are all white until you land on them, and the object of the game is to change every platform from white to some random color before going to the exit. Is there a script that could make platforms change to a random color on collision, as well as keep track of which platforms you’ve landed on so it doesn’t give you points for landing on platforms you’ve already gotten points for.

This is a pretty broad question, so I’ll give a broad answer:

  1. Create the platforms.

  2. Add a Rigidbody component in the inspector so that your player can collide with it. Make sure to disable gravity (you don’t want the platform falling with gravity) and enable “Is Kinematic” (you don’t want it to move when a player lands on it).

  3. You’ll need to create a script and attach it to each platform. Let’s name this script Platform. In the Platform script, next to Start() and Update(), add the function OnCollisionEnter as in the example given in the linked documentation. This function gets called whenever something collides with it (e.g.: player lands on it). Have it change color in that function using:

    GetComponent().material.color = new Color(1f, 0f, 0f, 1f);

This should be enough to get you going. Read/Watch tutorials to learn more.