I made a unity game about a month ago right after C# training and I seemed to have learned a lot and was able to finish it, but I haven't coded in about a month and it really sucks I forgot a lot of stuff. Simple stuff is annoying me right now. I'm trying to Raycast from my middle of my view and then get the name of the object I'm looking at in my console but I'm getting a error at the debug.log line. Here is my code. Also can anyone recommend some stuff to read to get refreshed on how to read unity C# code again?
asked Jul 31 '12 at 10:26 AM
You forgot to actually call the raycasting. See Physics.Raycast.
Your code should look like:
Note: the last parameter distance is optionnal. Default is Mathf.Infinity but it is always a good idea to set it to a sound value to improve performance and to prevent catching a very far object that is almost invisible to the player.