コード例 #1
0
        void OnGUI()
        {
            var currentY = 0f;

            if (IsDirty) // the data can be out-of-date, notify user to update it from Rider
            {
                var text    = "Save the scene and run Find Usages in Rider to get up-to-date results";
                var helpBox = GUILayoutUtility.GetRect(new GUIContent(text), EditorStyles.helpBox, GUILayout.MinHeight(40));
                currentY += helpBox.height;
                EditorGUI.HelpBox(helpBox, text, MessageType.Warning);
            }

            if (Target != null)
            {
                var text       = $"Usages of '{Target}'";
                var textHeight = GUILayoutUtility.GetRect(new GUIContent(text), EditorStyles.label).height * 1.2f;
                GUI.Box(new Rect(0, currentY, position.width, textHeight), text);
                currentY += textHeight;
            }

            myTreeView?.OnGUI(new Rect(0, currentY, position.width, position.height - currentY));
        }