Friday, May 24, 2013

Unity Ray debugging



Oh, this is a cool one I just noticed that again shows me the developer of Unity knows what they were doing.

function Update () {

    var ray : Ray = camera.ScreenPointToRay (Vector3(200,200,0));
    Debug.DrawRay (ray.origin, ray.direction * 10, Color.yellow);
}


How many times have I struggled to see where a ray or vector is doing in my game and written a ton of debug code (yes I did this with XNA) to draw a line where a ray was.  Unity gives me this as a simple Debug call.    Thank you thank you thank you.

No comments: