hi…
I would like to add a color palette on stage.
I want to change the color palette with this object.
The color of the object where you can make the user wants.
How can I do.
Would help.
Thank you.
ignore the colors in your code at first. Look at the different parts of the palette as just individuals objects. When a user/player clicks on an object, it changes his/her color to whatever color you code in for that block. Then, texture the objects with the appropriate colors.
a color palette of the game will be
man will choose the object
change the color of the object from the palette
I found a code
but not in the palette
Take a look at this
how the color palette, color changer, this rib.
I add buttons or color.
using UnityEngine;
using System.Collections;
public class SelectingAndManipulating : MonoBehaviour {
public GameObject selectedObject = null;
void Update()
{
if(Input.GetMouseButtonDown(0))
{
Ray ray = gameObject.camera.ScreenPointToRay(Input.mousePosition);
RaycastHit hit;
if(Physics.Raycast(ray, out hit))
{
selectedObject = hit.transform.gameObject;
}
}
}
void OnGUI()
{
GUI.Label(new Rect(20,180,150,20), “Selected Object:” + selectedObject.name);
selectedObject.renderer.material.color = RGBSliders(new Rect(0,0, 150,20), selectedObject.renderer.material .color);
}
Color RGBSliders(Rect loc, Color rgb)
{
rgb.r = GUI.HorizontalSlider (loc, rgb.r, 0.0f, 1.0f);
loc.y += 20;
rgb.g = GUI.HorizontalSlider (loc, rgb.g, 0.0f, 1.0f);
loc.y += 20;
rgb.b = GUI.HorizontalSlider (loc, rgb.b, 0.0f, 1.0f);
return rgb;
}
}