var display = "Sign Text Here";
function Update () {
var hit : RaycastHit;
if (Physics.Raycast (transform.position, Vector3.forward, hit, 1)) {
print(hit.transform.name);
}
}
I am using this code to determine if the character is standing in front of the sign. Unfortunately it would seem that the raycast is hitting… itself! As it returns “Sign” as soon as the game starts. Why is it doing such a thing?
Put the object on a different layer and have the raycast ignore that layer. (Although it seems to me that a trigger would be better for this sort of thing anyway.)