// Draw only this node on GUI
        public void DrawOnGUI(SearchResultDrawParameters parameters, string linkToPrevNodeDescription)
        {
            string label = string.IsNullOrEmpty(linkToPrevNodeDescription) ? description : (linkToPrevNodeDescription + "\n" + description);

            if (GUILayout.Button(label, Utilities.BoxGUIStyle, Utilities.GL_EXPAND_HEIGHT))
            {
                // If a reference is clicked, highlight it (either on Hierarchy view or Project view)
                UnityObject.SelectInEditor();
            }

            if (parameters.showTooltips && Event.current.type == EventType.Repaint && GUILayoutUtility.GetLastRect().Contains(Event.current.mousePosition))
            {
                parameters.tooltip = label;
            }
        }
        public void DrawOnGUI(SearchResultDrawParameters parameters)
        {
            parameters.tooltip = null;

            for (int i = 0; i < result.Count; i++)
            {
                result[i].DrawOnGUI(parameters);
            }

            if (parameters.tooltip != null)
            {
                // Show tooltip at mouse position
                Vector2 mousePos = Event.current.mousePosition;
                Vector2 size     = Utilities.TooltipGUIStyle.CalcSize(new GUIContent(parameters.tooltip));
                size.x += 10f;

                GUI.Box(new Rect(new Vector2(mousePos.x - size.x * 0.5f, mousePos.y - size.y), size), parameters.tooltip, Utilities.TooltipGUIStyle);
            }
        }
        // Draw all the paths that start with this node on GUI recursively
        public void DrawOnGUIRecursively(SearchResultDrawParameters parameters, string linkToPrevNodeDescription)
        {
            GUILayout.BeginHorizontal();

            DrawOnGUI(parameters, linkToPrevNodeDescription);

            if (links.Count > 0)
            {
                GUILayout.BeginVertical();

                for (int i = 0; i < links.Count; i++)
                {
                    ReferenceNode next = links[i].targetNode;
                    next.DrawOnGUIRecursively(parameters, links[i].description);
                }

                GUILayout.EndVertical();
            }

            GUILayout.EndHorizontal();
        }
        // Draw the results found for this container
        public void DrawOnGUI(SearchResultDrawParameters parameters)
        {
            Color c = GUI.color;

            GUI.color = Color.cyan;

            if (GUILayout.Button(title, Utilities.BoxGUIStyle, Utilities.GL_EXPAND_WIDTH, Utilities.GL_HEIGHT_40) && clickable)
            {
                // If the container (scene, usually) is clicked, highlight it on Project view
                AssetDatabase.LoadAssetAtPath <SceneAsset>(title).SelectInEditor();
            }

            GUI.color = Color.yellow;

            if (parameters.pathDrawingMode == PathDrawingMode.Full)
            {
                for (int i = 0; i < references.Count; i++)
                {
                    GUILayout.Space(5);
                    references[i].DrawOnGUIRecursively(parameters, null);
                }
            }
            else
            {
                if (referencePathsShortUnique == null)
                {
                    CalculateShortestPathsToReferences();
                }

                List <ReferencePath> pathsToDraw;
                if (parameters.pathDrawingMode == PathDrawingMode.ShortRelevantParts)
                {
                    pathsToDraw = referencePathsShortUnique;
                }
                else
                {
                    pathsToDraw = referencePathsShortest;
                }

                for (int i = 0; i < pathsToDraw.Count; i++)
                {
                    GUILayout.Space(5);

                    GUILayout.BeginHorizontal();

                    ReferencePath path = pathsToDraw[i];
                    path.startNode.DrawOnGUI(parameters, null);

                    ReferenceNode currentNode = path.startNode;
                    for (int j = 0; j < path.pathLinksToFollow.Length; j++)
                    {
                        ReferenceNode.Link link = currentNode[path.pathLinksToFollow[j]];
                        link.targetNode.DrawOnGUI(parameters, link.description);
                        currentNode = link.targetNode;
                    }

                    GUILayout.EndHorizontal();
                }
            }

            GUI.color = c;

            GUILayout.Space(10);
        }
        // Draw the results found for this container
        public void DrawOnGUI(SearchResultDrawParameters parameters)
        {
            Color c = GUI.color;

            GUI.color = Color.cyan;

            Rect  rect  = EditorGUILayout.GetControlRect(Utilities.GL_EXPAND_WIDTH, Utilities.GL_HEIGHT_40);
            float width = rect.width;

            rect.width = 40f;
            if (GUI.Button(rect, IsExpanded ? "v" : ">"))
            {
                IsExpanded = !IsExpanded;
                GUIUtility.ExitGUI();
            }

            rect.x    += 40f;
            rect.width = width - (parameters.searchResult != null ? 140f : 40f);
            if (GUI.Button(rect, Title, Utilities.BoxGUIStyle) && Type == GroupType.Scene)
            {
                // If the container (scene, usually) is clicked, highlight it on Project view
                AssetDatabase.LoadAssetAtPath <SceneAsset>(Title).SelectInEditor();
            }

            if (parameters.searchResult != null)
            {
                rect.x    += width - 140f;
                rect.width = 100f;
                if (GUI.Button(rect, "Refresh"))
                {
                    parameters.searchResult.RefreshSearchResultGroup(this, parameters.noAssetDatabaseChanges);
                    GUIUtility.ExitGUI();
                }
            }

            if (IsExpanded)
            {
                GUI.color = Color.yellow;

                if (PendingSearch)
                {
                    GUILayout.Box("Lazy Search: this scene potentially has some references, hit Refresh to find them", Utilities.BoxGUIStyle);
                }
                else if (references.Count == 0)
                {
                    GUILayout.Box("No references found...", Utilities.BoxGUIStyle);
                }
                else
                {
                    if (parameters.pathDrawingMode == PathDrawingMode.Full)
                    {
                        for (int i = 0; i < references.Count; i++)
                        {
                            GUILayout.Space(5);
                            references[i].DrawOnGUIRecursively(parameters, null);
                        }
                    }
                    else
                    {
                        if (referencePathsShortUnique == null)
                        {
                            CalculateShortestPathsToReferences();
                        }

                        List <ReferencePath> pathsToDraw;
                        if (parameters.pathDrawingMode == PathDrawingMode.ShortRelevantParts)
                        {
                            pathsToDraw = referencePathsShortUnique;
                        }
                        else
                        {
                            pathsToDraw = referencePathsShortest;
                        }

                        for (int i = 0; i < pathsToDraw.Count; i++)
                        {
                            GUILayout.Space(5);

                            GUILayout.BeginHorizontal();

                            ReferencePath path = pathsToDraw[i];
                            path.startNode.DrawOnGUI(parameters, null);

                            ReferenceNode currentNode = path.startNode;
                            for (int j = 0; j < path.pathLinksToFollow.Length; j++)
                            {
                                ReferenceNode.Link link = currentNode[path.pathLinksToFollow[j]];
                                link.targetNode.DrawOnGUI(parameters, link.description);
                                currentNode = link.targetNode;
                            }

                            GUILayout.EndHorizontal();
                        }
                    }
                }
            }

            GUI.color = c;

            GUILayout.Space(10);
        }