Hi there !
I’m new to Unity and I have to create a very simple scene. Here is a description :
3 transparent cubes and a different colour for each cube… that’s all !
I don’t need the cubes to change colour when we click on them but I need them to be transparent.
What did I try before asking this ?
Well, when I change the colour of a cube it actually changes the colour of all the cubes in my scene. (all the cubes are children of the same ImageTarget) I tried to create a new script and attached a different script to the different cubes. Here is the general content of the scripts :
using UnityEngine;
using System.Collections;
public class colourScript : MonoBehaviour {
// Use this for initialization
void Start () {
renderer.material.shader = Shader.Find ("Transparent/Diffuse");
renderer.material.color = new Color(0.5f,0.3f,0.2f,168);
}
// Update is called once per frame
void Update () {
}
}
The problems are that …
1.Transparency
My cube does not seem to be transparent as I need it to be. So I think that I am missing something but I have no idea of how to solve this problem…
2.RGB Colors
Moreover, I am using RGB to define the colors… so how can I convert the RGB numbers (range : 0 to 255) into float in the range [0,1] to use it as input of the Color function ?
Or maybe there is an easier way to get the result I want ?
Well, I hope that someone can help me
Thank you !