Gizmo Cube#
Description#
Displays a cube gizmo in the scene
Parameters#
| Name | Description |
|---|---|
| Mode | Whether to display a solid or a wireframe cube |
| Position | The position of the cube |
| Rotation | The rotation of the cube |
| Size | The size of the cube along each axis |
| Color | The color of the cube |
| Duration | The amount of seconds the cube will be displayed |
Code#
using System;
using UnityEngine;
using VisualScript.Icons;
namespace VisualScript.Runtime
{
[Title("Gizmo Cube")]
[Image(typeof(IconCubeSolid), ColorTheme.Type.Lime)]
[Description("Displays a cube gizmo in the scene")]
[Category("Debug/Gizmos/Cube")]
[Parameter("Mode", "Whether to display a solid or a wireframe cube")]
[Parameter("Position", "The position of the cube")]
[Parameter("Rotation", "The rotation of the cube")]
[Parameter("Size", "The size of the cube along each axis")]
[Parameter("Color", "The color of the cube")]
[Parameter("Duration", "The amount of seconds the cube will be displayed")]
[Keywords("Draw", "Debug", "Gizmo", "Box")]
[Serializable]
public class InstructionCoreDebugGizmoCube : Instruction
{
[SerializeField] private GizmoMode m_Mode = GizmoMode.Outline;
[SerializeField] private GetVector3 m_Position = new GetVector3();
[SerializeField] private GetQuaternion m_Rotation = new GetQuaternion();
[SerializeField] private GetVector3 m_Size = new GetVector3(Vector3.one);
[SerializeField] private GetColor m_Color = new GetColor(Color.green.SetAlpha(0.5f));
[SerializeField] private GetNumber m_Duration = new GetNumber(1f);
protected override string GetTitle(GameObject source) => $"Display {this.m_Mode} Cube at {this.m_Position}";
protected override Awaitable Run(Args args)
{
GizmosManager.Cube(
this.m_Position.Get(args),
this.m_Rotation.Get(args),
this.m_Size.Get(args),
this.m_Color.Get(args),
this.m_Mode,
this.m_Duration.GetFloat(args)
);
return Done;
}
}
}