Gizmo Line#
Description#
Displays a line gizmo between two points in the scene
Parameters#
| Name | Description |
|---|---|
| From | The position where the line starts |
| To | The position where the line ends |
| Color | The color of the line |
| Duration | The amount of seconds the line will be displayed |
Code#
using System;
using UnityEngine;
using VisualScript.Icons;
namespace VisualScript.Runtime
{
[Title("Gizmo Line")]
[Image(typeof(IconLineStartEnd), ColorTheme.Type.Lime)]
[Description("Displays a line gizmo between two points in the scene")]
[Category("Debug/Gizmos/Line")]
[Parameter("From", "The position where the line starts")]
[Parameter("To", "The position where the line ends")]
[Parameter("Color", "The color of the line")]
[Parameter("Duration", "The amount of seconds the line will be displayed")]
[Keywords("Draw", "Debug", "Gizmo", "Segment")]
[Serializable]
public class InstructionCoreDebugGizmoLine : Instruction
{
[SerializeField] private GetVector3 m_From = new GetVector3();
[SerializeField] private GetVector3 m_To = 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 Line from {this.m_From} to {this.m_To}";
protected override Awaitable Run(Args args)
{
GizmosManager.Line(
this.m_From.Get(args),
this.m_To.Get(args),
this.m_Color.Get(args),
this.m_Duration.GetFloat(args)
);
return Done;
}
}
}