Get color from ColorPicker and apply it randomly on GameObject
Hello there,
My problem is pretty hard to explain. The player is in the menu and has to use 5 ColorPicker to define 5 colors he likes. Then those 5 colors must be stocked into an array ( I guess it is the best way to re use it). In the game, the array of color is used to color randomly 5 targets. So my question is : how can i get those 5 colors from colorpicker, put it in an array, and use the array to assign randomly a color to target ?
I'm using a colorpicker that i found but i don't really understand where the selected color is going, I have this script that allows me to change the color of a GameObject with the colorpicker, but is it possible to just get the color of this colorpicker without using some random GameObject as support ?
void OnSetColor(Color color)
{
Material mt = new Material(GetComponent<Renderer>().sharedMaterial);
mt.color = color;
GetComponent<Renderer>().material = mt;
}
void OnGetColor(ColorPicker picker)
{
picker.NotifyColor(GetComponent<Renderer>().material.color);
}
}
Thank you for the help
Your answer
Follow this Question
Related Questions
How To change a Text Object's Color Randomly using Color 32? 2 Answers
Please Help With Script 1 Answer
How to create a mesh at a location with code? 1 Answer
Continuing a Dialogue 0 Answers
Rotate character 0 Answers