layerHit not providing the proper layer that is hit

After implementing the change of

print("Cursor raycast hit " + cameraRaycaster.layerHit);

from the original

print("Cursor raycast hit " +;

In console it only prints that I have hit the enemy layer. Everything works to the point before the code change. I have checked the assigned layers on the “Walkable” and “Enemy” and they are all on the correct gameobjects. I am thinking maybe I did something and the Raycast sees everything as an enemy layer, but not sure.

Problem solved. For some reason there was a “PostProccessing” layer at layer 8. So it staggered Walkable and Enemy layers by 1 spot. Just placed the layer names in the right number spot and fixed it.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms