Debug.DrawRay Manual     Reference     Scripting  
Scripting > Runtime Classes > Debug
Debug.DrawRay

static function DrawRay (start : Vector3, dir : Vector3, color : Color = Color.white) : void

Description

Draws a line from start to start + dir with color.

JavaScripts
// Draws a 10 meter long green line from the position
// forward along the transform's z-axis.
function Update () {
var forward : Vector3 = transform.TransformDirection(Vector3.forward) * 10;
Debug.DrawRay (transform.position, Vector3.forward * 10, Color.green);
}

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
void Update() {
Vector3 forward = transform.TransformDirection(Vector3.forward) * 10;
Debug.DrawRay(transform.position, Vector3.forward * 10, Color.green);
}
}

import UnityEngine
import System.Collections

class example(MonoBehaviour):

def Update():
forward as Vector3 = (transform.TransformDirection(Vector3.forward) * 10)
Debug.DrawRay(transform.position, (Vector3.forward * 10), Color.green)