---
tags:
    - "Draw"
    - "Debug"
    - "Gizmo"
    - "Direction"
---

# Gizmo Ray

[Debug](../index.md) / [Gizmos](index.md) / **Gizmo Ray**

## Description

Displays a ray gizmo from a position along a direction in the scene

## Parameters

| Name | Description |
| :--- | :---------- |
| Position | The position where the ray starts |
| Direction | The direction and length of the ray |
| Color | The color of the ray |
| Duration | The amount of seconds the ray will be displayed |

## Code

```cs
using System;
using UnityEngine;
using VisualScript.Icons;

namespace VisualScript.Runtime
{
    [Title("Gizmo Ray")]
    [Image(typeof(IconLineStartEnd), ColorTheme.Type.Lime, typeof(BadgeExitRight))]

    [Description("Displays a ray gizmo from a position along a direction in the scene")]
    [Category("Debug/Gizmos/Ray")]

    [Parameter("Position", "The position where the ray starts")]
    [Parameter("Direction", "The direction and length of the ray")]
    [Parameter("Color", "The color of the ray")]
    [Parameter("Duration", "The amount of seconds the ray will be displayed")]

    [Keywords("Draw", "Debug", "Gizmo", "Direction")]

    [Serializable]
    public class InstructionCoreDebugGizmoRay : Instruction
    {
        [SerializeField] private GetVector3 m_Position = new GetVector3();
        [SerializeField] private GetVector3 m_Direction = new GetVector3(Vector3.forward);
        [SerializeField] private GetColor m_Color = new GetColor(Color.green);
        [SerializeField] private GetNumber m_Duration = new GetNumber(1f);

        protected override string GetTitle(GameObject source) => $"Display Ray at {this.m_Position}";

        protected override Awaitable Run(Args args)
        {
            GizmosManager.Ray(
                this.m_Position.Get(args),
                this.m_Direction.Get(args),
                this.m_Color.Get(args),
                this.m_Duration.GetFloat(args)
            );

            return Done;
        }
    }
}
```

