Hello!
I am trying to get the object reference during game Play……And change the apply texture on it or any color that will be selected from menu…So i try this code…it is telling that there is some object front of you… but i want to know which object is front of me…
SelectTarget is transform object and target is list of objects…
So by targets[0];
i am assigning the value of specific object manually…I want to change it that what is front of you return you the component name or any think for identification…
if (Physics.Raycast(transform.position, fwd, 100))
{ print(“There is something in front of the object!”);
// selectedTarget = (Transform)hit.collider.gameObject;
selectedTarget = targets[0];
selectedTarget.renderer.material.color = Color.red;
}