I have literally spent all day researching the light out of Unity C# Raycasting and I have nothing to show for it. I have studied tutorials, online resources, stack overflow questions, and have even word for word copied script in hopes that Unity would finally recognize all my attempts to actually use a Raycast. Here is an example of a script using Raycast that simply won't work for me:
if (mouseDown) {
print ("mouse is down");
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
RaycastHit hit;
if (Physics.Raycast(ray, out hit)) {
print ("response???");
}
}
I feel like this should work... but it's not. The mouseDown is working as it should but when I click on my object it refuses to acknowledge the rayhit from my mouse position to the object. I should also mention that the project is in 2D. Any suggestions?