public override void OnInspectorGUI() { EditorGUILayout.BeginVertical(); bool click = false; if (m_isSyncRequired) { EditorGUILayout.HelpBox("One or more prefabs have been changed. AssetLibrary need to be synchronized.", MessageType.Warning); click = GUILayout.Button("Synchronize"); } m_projectGUI.OnGUI(); EditorGUILayout.Space(); m_assetsGUI.OnGUI(); EditorGUILayout.Space(); if (click) { Asset.Sync(); m_assetsGUI = new AssetLibraryAssetsGUI(); m_assetsGUI.InitIfNeeded(); m_assetsGUI.SetSelectedFolders(m_projectGUI.SelectedFolders); m_assetsGUI.OnEnable(); m_isSyncRequired = false; SaveAsset(); } EditorGUILayout.EndVertical(); }
public override void OnInspectorGUI() { EditorGUILayout.BeginVertical(); bool click = false; if (m_isSyncRequired) { EditorGUILayout.HelpBox("One or more prefabs have been changed. AssetLibrary need to be synchronized.", MessageType.Warning); click = GUILayout.Button("Synchronize"); } m_projectGUI.OnGUI(); m_assetsGUI.OnGUI(); //EditorGUI.BeginChangeCheck(); //EditorGUILayout.Space(); // EditorGUILayout.BeginHorizontal(); //Asset.KeepRuntimeProjectInSync = EditorGUILayout.Toggle("Keep in sync", Asset.KeepRuntimeProjectInSync); //EditorGUILayout.EndHorizontal(); // if (Asset.KeepRuntimeProjectInSync) //{ // EditorGUILayout.HelpBox("Runtime project tree will be updated each time you launch runtime editor and will reflect all changes in this asset library", MessageType.Info); //} //if(EditorGUI.EndChangeCheck()) //{ // SaveAsset(); //} EditorGUILayout.Space(); //EditorGUILayout.BeginHorizontal(); //GUILayout.FlexibleSpace(); //GUILayout.Button("Create Reference", GUILayout.Width(100)); //EditorGUILayout.EndHorizontal(); if (click) { Asset.Sync(); m_assetsGUI = new AssetLibraryAssetsGUI(); m_assetsGUI.InitIfNeeded(); m_assetsGUI.SetSelectedFolders(m_projectGUI.SelectedFolders); m_assetsGUI.OnEnable(); m_isSyncRequired = false; SaveAsset(); } EditorGUILayout.EndVertical(); }
private DragAndDropVisualMode PerformDrop(TreeViewItem parent, int insertIndex, bool outside) { DragAndDrop.AcceptDrag(); var draggedRows = DragAndDrop.GetGenericData(AssetTreeView.k_GenericDragID) as List <TreeViewItem>; if (draggedRows != null) { foreach (TreeViewItem <AssetInfo> dragged_object in draggedRows) { if (!outside) { AssetFolderInfo folder = GetAssetFolderInfo(parent); m_assetsGUI.InitIfNeeded(); m_assetsGUI.AddAssetToFolder(dragged_object.data, folder); } } } else { m_moveDialogDisplayed = false; m_moveToNewLocation = true; List <UnityObject> assets = new List <UnityObject>(); foreach (UnityObject dragged_object in DragAndDrop.objectReferences) { string path = AssetDatabase.GetAssetPath(dragged_object); if (!string.IsNullOrEmpty(path) && File.Exists(path)) { if (!outside) { assets.Add(dragged_object); } } else { if (!CanDrop(dragged_object)) { continue; } m_assetsGUI.InitIfNeeded(); AssetFolderInfo folder = CopyFolder(path, parent, insertIndex); if (folder == null) { return(DragAndDropVisualMode.Rejected); } TreeView.SetSelection(new[] { folder.id }, TreeViewSelectionOptions.RevealAndFrame); SelectedFolders = new[] { folder }; if (SelectedFoldersChanged != null) { SelectedFoldersChanged(this, EventArgs.Empty); } } } UnityObject[] assetsArray = assets.ToArray(); if (assetsArray.Length > 0) { MoveToNewLocationDialog(assetsArray); AssetFolderInfo folder = GetAssetFolderInfo(parent); m_assetsGUI.InitIfNeeded(); m_assetsGUI.AddAssetToFolder(assetsArray, folder, m_moveToNewLocation); } } return(DragAndDropVisualMode.Copy); }