Change color of a player while pressing on a cube!

Hi
I’ve have made a game were you in the main menu can press on a cube and it will change to a color, it works fine, but i also have to change the players color to the same which is in another scene. Any ideas how its should be done?
Thanks
That its my code
Code (CSharp):

  • void OnMouseDown() {
  • GetComponent().material.color = Random.ColorHSV(0f, 1f, 1f, 1f, 0.5f, 1f);
    • }

Use code tags when posting code please.

To pass data between scenes you could use a static Game Manager class, that uses DontDestroyOnLoad() to persist between scenes. You could set a color variable to this script in one scene, and it will then persist into the next scene.