为什么它不在编辑器中绘制圆形 Gizmo?

Why does it not draw the circle gizmo in editor?

我正在尝试在编辑器中绘制一个简单的圆圈。 我找到了这个方法,但我不明白为什么它不起作用。 如何在编辑器中绘制圆圈? 谢谢。

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#endif

public class Assigments : MonoBehaviour
{
    Transform obj;

    [Range(0, 3f)]
    public float radious = 1f;

#if UNITY_EDITOR
    private void OnDrawGizmos()
    {
        Debug.Log("works");
        Vector2 origin = transform.position;
        Handles.color = Color.red;
        Handles.DrawWireDisc(origin, new Vector3(0, 0, 1), radious);
    }
#endif
}

试试这个。

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Assigments : MonoBehaviour
{
    public float lookRadius = 10f;
    void OnDrawGizmosSelected()
    {
        Gizmos.color = Color.red;
        Gizmos.DrawWireSphere(transform.position, lookRadius);
    }
}

所以!我犯了一个大错。我没有选择“gizmo”按钮。实际上 none 我的小发明出现了。我教过只有我做的那个没有出现。在我选择 Gizmo 按钮后,一切正常。

PS: 我写的代码完美运行。 所以OxPikolo给出的解决方案。

谢谢你,很抱歉你是个菜鸟,哈哈。