- Home /
Question by
vishu19sep · Dec 02, 2017 at 06:24 PM ·
raycastarraymaterial
How to change colour of Game objects when hit by ray cast using array
I tried this but not working -
if (Physics.Raycast (headpostion, gazedirection, out hitinfo, maxdistance, sphere)) {
//this is working
Debug.Log ("tag is not spheres");
if (hitinfo.collider.tag == "spheres") {
//this is working
Debug.Log ("tag is spheres");
//this is not working
for (int i = 0; i < cubecolor.Length; i++)
{
cubecolor[i].SetColor ("_Color", Color.yellow);
}
}
Comment
Your answer
Follow this Question
Related Questions
Make a selection 0 Answers
Raycast cycle problem? 0 Answers
Change Transparency 1 Answer
Raycast Arrays 1 Answer
Don't destroy material 0 Answers