コード例 #1
0
 void OnEnable()
 {
     m_positionType = serializedObject.FindProperty("positionType");
     m_rayDistance  = serializedObject.FindProperty("rayDistance");
     mcpt           = (mouseCousorPositionType)m_positionType.intValue;
     rayDis         = m_rayDistance.intValue;
 }
コード例 #2
0
    //绘制窗口
    public override void OnInspectorGUI()
    {
        serializedObject.Update();

        mcpt = (mouseCousorPositionType)EditorGUILayout.EnumPopup("Canvas Render mode", mcpt);

        if (mcpt == mouseCousorPositionType.WorldSpace)
        {
            rayDis = EditorGUILayout.IntField("RayDistance", rayDis);
        }

        if (GUI.changed)
        {
            m_positionType.intValue = (int)mcpt;
            m_rayDistance.intValue  = rayDis;
            serializedObject.ApplyModifiedProperties();
        }
    }