Gizmo Sphere#
Description#
Displays a spherical gizmo in the scene
Parameters#
| Name | Description |
|---|---|
| Mode | Whether to display a solid or a wireframe sphere |
| Position | The position of the sphere |
| Rotation | The rotation of the sphere |
| Radius | The radius of the sphere |
| Color | The color of the sphere |
| Duration | The amount of seconds the sphere will be displayed |
Code#
using System;
using UnityEngine;
using VisualScript.Icons;
namespace VisualScript.Runtime
{
[Title("Gizmo Sphere")]
[Image(typeof(IconSphereSolid), ColorTheme.Type.Lime)]
[Description("Displays a spherical gizmo in the scene")]
[Category("Debug/Gizmos/Sphere")]
[Parameter("Mode", "Whether to display a solid or a wireframe sphere")]
[Parameter("Position", "The position of the sphere")]
[Parameter("Rotation", "The rotation of the sphere")]
[Parameter("Radius", "The radius of the sphere")]
[Parameter("Color", "The color of the sphere")]
[Parameter("Duration", "The amount of seconds the sphere will be displayed")]
[Keywords("Print", "Console", "Debug", "Gizmo")]
[Serializable]
public class InstructionCoreDebugGizmoSphere : Instruction
{
[SerializeField] private GizmoMode m_Mode = GizmoMode.Outline;
[SerializeField] private GetVector3 m_Position = new GetVector3();
[SerializeField] private GetQuaternion m_Rotation = new GetQuaternion();
[SerializeField] private GetNumber m_Radius = new GetNumber(1f);
[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} Sphere at {this.m_Position}";
protected override Awaitable Run(Args args)
{
GizmosManager.Sphere(
this.m_Position.Get(args),
this.m_Rotation.Get(args),
this.m_Radius.GetFloat(args),
this.m_Color.Get(args),
this.m_Mode,
this.m_Duration.GetFloat(args)
);
return Done;
}
}
}