Hey guys,
So i have gameObjects with the same script attached to it that outlines the mesh, but i want to activate it when raycast hits and deactivate when it doesnt. The code i have below gives me an error:
if (Physics.Raycast (shootPoint.position, shootPoint.transform.forward, out hit, 4f)) {
if (hit.transform.name == “Handgun”) {
hit.collider.gameObject.GetComponentInChildren ().enabled = true;
}
} else
hit.collider.gameObject.GetComponentInChildren ().enabled = false;
}
Anyone have a solution to this?