Thank you for replying, I have tried longer distances and it doesn't seem to work, I am just trying to get the camera to move when its view is obstructed, is there any other way to detect this.

I am struggling a bit to understand the relationship between distance and direction. What sort of values should I try, I was under the impression if I could see the debug line hitting the terrain it should register hit, am I wrong about its operation?

Try Raycast instead of Raycast 2 and see if it makes a difference. Could be a bug in the action, although I haven't seen it. Also try on a non-terrain object. (unlikely an issue, but terrains do weird things)

Thank you for the advice, I moved onto Raycast 2 after not having any luck with the normal one, really strange bug. Just tried on scene objects and still no hit. Can anyone replicate this in Unity 5 with a simple project. (I have already started new project to check and no luck).

Well that's good, can you see with my setup what I might be doing wrong? should the raycast fire if any part of it is broken or only at the very tip of the raycast? what distance/direction values do you use?

The direction is where you want the raycast to go from the origin point that you specified. Typically if you want it to go 'forward' you would say xyz 0,0,1 as the Z axis is considered forward, and you would specify to use Self space.

The distance means how far you want the raycast to go before it gives up trying to hit something. This is normally a high number unless you deliberately want it to only be possible to return a hit on very close objects.

The hit event is only fired if the raycast goes in the specified direction and hits something on the layer mask that is within the distance threshold.

The Store Hit Object variable is for storing whatever the raycast happens to hit.

Thank you, that is very helpful.So in my screenshot above I am trying to have it so the camera moves when its view is obstructed by terrain, would you expect it to detect the terrain in the picture with my current settings? if so I might need to go back to the drawing board with my terrain in case that is causing the problem.