// returns true if the element should be removed
        private bool DrawElement(ObjectReference reference)
        {
            if (reference == null)
            {
                return(true);
            }

            var drawData  = reference.GetProvidedData();
            var sceneData = drawData.SceneData;

            float inspectorWidth = EditorGUIUtility.currentViewWidth;
            float buttonWidth    = inspectorWidth + BORDER_SPACE;

            buttonWidth = sceneData.IsScene ? (buttonWidth / 3) - 2.5f : buttonWidth;

            GUILayout.BeginHorizontal();

#if UNITY_5_4_OR_NEWER
            GUILayout.Label(drawData.Icon, GUILayout.Width(ICON_SIZE), GUILayout.Height(ICON_SIZE), GUILayout.MaxWidth(ICON_SIZE), GUILayout.MaxHeight(ICON_SIZE));
#else
            buttonWidth += ICON_SIZE + 10;
#endif

            if (GUILayout.Button(drawData.Name, GUILayout.MaxWidth(buttonWidth), GUILayout.Width(buttonWidth), GUILayout.ExpandWidth(false)))
            {
                reference.UpdateCachedData();
                reference.Select();
            }

#if UNITY_5_4_OR_NEWER
            if (sceneData.IsScene)
            {
                var scene = sceneData.Scene;
                // Playmode
                if (Application.isPlaying)
                {
                    if (GUILayout.Button("Load", GUILayout.MaxWidth(buttonWidth * 2 + 2.5f), GUILayout.Width(buttonWidth * 2 + 2.5f), GUILayout.ExpandWidth(false)))
                    {
                        SceneManager.LoadScene(AssetDatabase.GetAssetOrScenePath(scene));
                    }
                }
                else
                {
                    if (GUILayout.Button("Load", GUILayout.MaxWidth(buttonWidth), GUILayout.Width(buttonWidth), GUILayout.ExpandWidth(false)))
                    {
                        if (EditorSceneManager.SaveCurrentModifiedScenesIfUserWantsTo())
                        {
                            EditorSceneManager.OpenScene(AssetDatabase.GetAssetOrScenePath(scene), OpenSceneMode.Single);
                        }
                    }

                    if (GUILayout.Button("Play", GUILayout.MaxWidth(buttonWidth), GUILayout.Width(buttonWidth), GUILayout.ExpandWidth(false)))
                    {
                        if (EditorSceneManager.SaveCurrentModifiedScenesIfUserWantsTo())
                        {
                            EditorSceneManager.OpenScene(AssetDatabase.GetAssetOrScenePath(scene), OpenSceneMode.Single);
                        }
                        EditorApplication.isPlaying = true;
                    }
                }
            }
#endif

            var alignmentBckp = GUIStyle.none.alignment;
            GUIStyle.none.alignment = TextAnchor.LowerCenter;
            if (GUILayout.Button(CLOSE_ICON, GUIStyle.none, GUILayout.Width(ICON_SIZE), GUILayout.Height(ICON_SIZE)))
            {
                return(true);
            }

            GUIStyle.none.alignment = alignmentBckp;
            GUILayout.EndHorizontal();
            GUILayout.Space(5);
            return(false);
        }
 public void RemoveReference(ObjectReference obj)
 {
     References.Remove(obj);
     EditorUtility.SetDirty(this);
     AssetDatabase.SaveAssets();
 }