void OnEnable() { m_positionType = serializedObject.FindProperty("positionType"); m_rayDistance = serializedObject.FindProperty("rayDistance"); mcpt = (mouseCousorPositionType)m_positionType.intValue; rayDis = m_rayDistance.intValue; }
//绘制窗口 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(); } }