Gizmo Arrow#
Description#
Displays an arrow gizmo from a position along a direction in the scene
Parameters#
| Name | Description |
|---|---|
| Position | The position where the arrow starts |
| Direction | The direction and length of the arrow |
| Color | The color of the arrow |
| Duration | The amount of seconds the arrow will be displayed |
Code#
using System;
using UnityEngine;
using VisualScript.Icons;
namespace VisualScript.Runtime
{
[Title("Gizmo Arrow")]
[Image(typeof(IconArrowRight), ColorTheme.Type.Lime)]
[Description("Displays an arrow gizmo from a position along a direction in the scene")]
[Category("Debug/Gizmos/Arrow")]
[Parameter("Position", "The position where the arrow starts")]
[Parameter("Direction", "The direction and length of the arrow")]
[Parameter("Color", "The color of the arrow")]
[Parameter("Duration", "The amount of seconds the arrow will be displayed")]
[Keywords("Draw", "Debug", "Gizmo", "Direction", "Vector")]
[Serializable]
public class InstructionCoreDebugGizmoArrow : 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 Arrow at {this.m_Position}";
protected override Awaitable Run(Args args)
{
GizmosManager.Arrow(
this.m_Position.Get(args),
this.m_Direction.Get(args),
this.m_Color.Get(args),
this.m_Duration.GetFloat(args)
);
return Done;
}
}
}