- Home /
Gizmos not working on Unity 5.0.1p1
I have tried using a basic script like this among others and no Gizmo is displayed, does anyone have any ideas?
// C#
// Creates a sphere where the gizmo is painted in the scene view.
using UnityEngine;
using UnityEditor;
public class ScriptableWizardOnDrawGizmos : ScriptableWizard
{
public Vector3 spherePosition = Vector3.zero;
public float sphereRadius = 1;
[MenuItem("Example/OnDrawGizmos example")]
static void CreateWindow()
{
ScriptableWizard.DisplayWizard(
"Create a Sphere",
typeof(ScriptableWizardOnDrawGizmos),
"Create!");
}
void OnWizardUpdate()
{
helpString =
"Set the sphere position and the sphere radius to draw the gizmo in the scene view";
if (sphereRadius > 0)
{
errorString = "";
isValid = true;
}
else
{
errorString = "Radius has to be greater than 0";
isValid = false;
}
}
public void OnDrawGizmos()
{
Gizmos.color = Color.red;
Gizmos.DrawSphere(spherePosition, sphereRadius);
}
void OnWizardCreate()
{
GameObject createdSphere = GameObject.CreatePrimitive(PrimitiveType.Sphere);
createdSphere.transform.position = spherePosition;
createdSphere.transform.localScale = new Vector3(sphereRadius, sphereRadius, sphereRadius);
}
}
Comment
Your answer
Follow this Question
Related Questions
Scene view stretches camera frustum gizmo 4 Answers
What is a difference between GizmoType.Active and GizmoType.Selected? 1 Answer
Gizmo question: How do I create a field of view using gizmos? 1 Answer
Select object by selecting gizmo or handle? 1 Answer
Component on SceneView camera has wrong gameObject In OnDrawGizmos. 0 Answers