public static object GetProjectProperty(this IVsHierarchy hierarchy, HierarchyProperty property) { hierarchy.GetProperty(VSConstants.VSITEMID_ROOT, (int)property, out object rawValue); return(rawValue); }
private static void _SeprateScene(string path) { if (path.EndsWith("_add.unity")) { return; } string rootPath = "Assets/XSeperateScene/"; string name = path; int index = path.LastIndexOf("/"); if (index >= 0) { name = name.Substring(index + 1); } index = name.LastIndexOf("."); if (index >= 0) { name = name.Substring(0, index); } EditorSceneManager.OpenScene(path); GameObject go = GameObject.Find("Scene"); if (go != null) { //1.save as new scene string addpath = string.Format("{0}{1}_add.unity", rootPath, name); Scene addScene = EditorSceneManager.GetSceneByPath(addpath); EditorSceneManager.SaveScene(addScene); //2.save as old scene GameObject.DestroyImmediate(go); LightmapSettings.lightmaps = null; LightmapSettings.lightProbes = null; string origpath = string.Format("{0}{1}.unity", rootPath, name); Scene oriScene = EditorSceneManager.GetSceneByPath(origpath); EditorSceneManager.SaveScene(oriScene); addScene = EditorSceneManager.OpenScene(addpath); List <GameObject> gos = new List <GameObject>(); HierarchyProperty hp = new HierarchyProperty(HierarchyType.GameObjects); int[] expanded = new int[0]; while (hp.Next(expanded)) { gos.Add(hp.pptrValue as GameObject); } for (int i = gos.Count - 1; i >= 0; --i) { if (gos[i].name != "Scene") { GameObject.DestroyImmediate(gos[i]); } } StaticOcclusionCulling.Cancel(); EditorSceneManager.SaveScene(addScene, addpath); } else { LightmapSettings.lightmaps = null; LightmapSettings.lightProbes = null; string origpath = string.Format("{0}{1}.unity", rootPath, name); Scene oriScene = EditorSceneManager.GetSceneByPath(origpath); EditorSceneManager.SaveScene(oriScene); } }
extern public static DragAndDropVisualMode HierarchyWindowDrag(HierarchyProperty property, bool perform, HierarchyDropMode dropMode);
public static IEnumerable <T> EnumerateAssets <T>(HierarchyProperty property, System.Func <HierarchyProperty, T> selector) { return(EnumerateAssets(property, selector, p => true)); }
public ScriptForgeStyles() { LoadFont(FONT_AWESOME_SEARCH_FILTER, ref m_FontAwesomeFont); LoadFont(TITLE_FONT_NAME, ref m_TitleFont); LoadFont(NORMAL_FONT_NAME, ref m_NormalFont); // Spacer spacer = new GUIStyle(GUI.skin.box); spacer.fixedHeight = 5f; spacer.fixedWidth = 0f; spacer.stretchWidth = true; // Title Bar Icon titleBarIcon = new GUIStyle(GUI.skin.label); titleBarIcon.fontSize = 35; titleBarIcon.fixedWidth = 50f; titleBarIcon.fontStyle = FontStyle.Normal; titleBarIcon.alignment = TextAnchor.MiddleCenter; titleBarIcon.wordWrap = false; titleBarIcon.clipping = TextClipping.Overflow; titleBarIcon.imagePosition = ImagePosition.TextOnly; titleBarIcon.font = fontAwesomeFont; titleBarIcon.normal.textColor = Color.white; // Title title = new GUIStyle(GUI.skin.label); title.fontSize = 30; title.fixedWidth = 50f; title.fixedHeight = 50f; title.fontStyle = FontStyle.Normal; title.alignment = TextAnchor.LowerLeft; title.wordWrap = false; title.contentOffset = new Vector2(-10f, 10f); title.clipping = TextClipping.Overflow; title.imagePosition = ImagePosition.TextOnly; title.font = rustFont; title.normal.textColor = Color.white; // Sub Title subTitle = new GUIStyle(GUI.skin.label); subTitle.fontSize = 15; subTitle.fixedWidth = 50f; subTitle.fontStyle = FontStyle.Normal; subTitle.alignment = TextAnchor.MiddleCenter; subTitle.wordWrap = false; subTitle.contentOffset = new Vector2(80, 40f); subTitle.clipping = TextClipping.Overflow; subTitle.imagePosition = ImagePosition.TextOnly; subTitle.font = rustFont; subTitle.normal.textColor = Color.white; // Button button = new GUIStyle(GUI.skin.button); button.fontSize = 20; button.fontStyle = FontStyle.Normal; button.alignment = TextAnchor.MiddleCenter; button.font = thapkieMGFont; button.fixedHeight = EditorGUIUtility.singleLineHeight * 2f; // Mini Button Left miniButtonLeft = new GUIStyle(EditorStyles.miniButtonLeft); miniButtonLeft.fontSize = 12; miniButtonLeft.fontStyle = FontStyle.Normal; miniButtonLeft.alignment = TextAnchor.MiddleCenter; miniButtonLeft.font = thapkieMGFont; buttonLeft = new GUIStyle(miniButtonLeft); buttonLeft.fontSize = 15; buttonLeft.fixedHeight = EditorGUIUtility.singleLineHeight * 2f; // Mini Button Middle miniButtonMiddle = new GUIStyle(EditorStyles.miniButtonMid); miniButtonMiddle.fontSize = 12; miniButtonMiddle.fontStyle = FontStyle.Normal; miniButtonMiddle.alignment = TextAnchor.MiddleCenter; miniButtonMiddle.font = thapkieMGFont; buttonMiddle = new GUIStyle(miniButtonMiddle); buttonMiddle.fontSize = 15; buttonMiddle.fixedHeight = EditorGUIUtility.singleLineHeight * 2f; // Mini Button Middle icon miniButtonLeftIcon = new GUIStyle(miniButtonLeft); miniButtonLeftIcon.fontSize = 13; miniButtonLeftIcon.stretchWidth = false; miniButtonLeftIcon.stretchHeight = true; miniButtonLeftIcon.font = m_FontAwesomeFont; // Mini Button Right miniButtonRight = new GUIStyle(EditorStyles.miniButtonRight); miniButtonRight.fontSize = 12; miniButtonRight.fontStyle = FontStyle.Normal; miniButtonRight.alignment = TextAnchor.MiddleCenter; miniButtonRight.font = thapkieMGFont; buttonRight = new GUIStyle(miniButtonRight); buttonRight.fontSize = 15; buttonRight.fixedHeight = EditorGUIUtility.singleLineHeight * 2f; // Widget Header Text widgetHeaderText = new GUIStyle(GUI.skin.label); widgetHeaderText.fontSize = 22; widgetHeaderText.alignment = TextAnchor.UpperLeft; widgetHeaderText.wordWrap = true; widgetHeaderText.richText = true; widgetHeaderText.contentOffset = new Vector2(8f, 1f); widgetHeaderText.font = rustFont; widgetHeaderIcon = new GUIStyle(widgetHeaderText); widgetHeaderIcon.fixedHeight = 28f; widgetHeaderIcon.fixedWidth = 28f; widgetHeaderIcon.font = fontAwesomeFont; widgetHeaderIcon.contentOffset = new Vector2(5, 2); scriptForgeIconSmall = new GUIStyle(); scriptForgeIconSmall.stretchWidth = true; scriptForgeIconSmall.stretchHeight = true; scriptForgeIconSmall.fixedHeight = 50; scriptForgeIconSmall.fixedWidth = 50; scriptForgeIconSmall.margin = new RectOffset(0, 0, 5, 5); // Icon Button fontAwesomeButton = new GUIStyle(GUI.skin.button); fontAwesomeButton.fontSize = 30; fontAwesomeButton.fontStyle = FontStyle.Normal; fontAwesomeButton.alignment = TextAnchor.MiddleCenter; fontAwesomeButton.wordWrap = false; fontAwesomeButton.clipping = TextClipping.Overflow; fontAwesomeButton.font = fontAwesomeFont; HierarchyProperty serach = new HierarchyProperty(HierarchyType.Assets); serach.SetSearchFilter("t:Texture ScriptForgeIcon", 0); serach.Next(null); if (serach.pptrValue != null) { scriptForgeIconSmall.normal.background = (Texture2D)serach.pptrValue; } }
public static HierarchyPropertyCache Find(string assetPath) { var property = new HierarchyProperty(assetPath); return(new HierarchyPropertyCache(property)); }
public HierarchyData(HierarchyProperty property) { name = property.name; // TODO: Hierarchy indices at runtime m_Index = property.instanceID; }
void UpdateHierarchyData() { m_ObjectTypes.Clear(); if (m_HierarchyProperty == null) { m_HierarchyProperty = new HierarchyProperty(HierarchyType.GameObjects); } else { m_HierarchyProperty.Reset(); } var hasChanged = false; var lastDepth = 0; m_DataStack.Clear(); m_SiblingIndexStack.Clear(); m_DataStack.Push(null); m_SiblingIndexStack.Push(0); while (m_HierarchyProperty.Next(null)) { var instanceID = m_HierarchyProperty.instanceID; var go = EditorUtility.InstanceIDToObject(instanceID) as GameObject; var currentDepth = m_HierarchyProperty.depth; if (m_IgnoreList.Contains(go)) { var depth = currentDepth; // skip children of EVR to prevent the display of EVR contents while (m_HierarchyProperty.Next(null) && m_HierarchyProperty.depth > depth) { } currentDepth = m_HierarchyProperty.depth; instanceID = m_HierarchyProperty.instanceID; // If EVR is the last object, early out if (instanceID == 0) { break; } } if (currentDepth <= lastDepth) { if (m_DataStack.Count > 1) // Pop off last sibling { if (CleanUpHierarchyData(m_DataStack.Pop(), m_SiblingIndexStack.Pop())) { hasChanged = true; } } var count = lastDepth - currentDepth; while (count-- > 0) { if (CleanUpHierarchyData(m_DataStack.Pop(), m_SiblingIndexStack.Pop())) { hasChanged = true; } } } var parent = m_DataStack.Peek(); var siblingIndex = m_SiblingIndexStack.Pop(); if (parent != null && parent.children == null) { parent.children = new List <HierarchyData>(); } var children = parent == null ? m_HierarchyData : parent.children; HierarchyData currentHierarchyData; if (siblingIndex >= children.Count) { currentHierarchyData = new HierarchyData(m_HierarchyProperty); var types = new HashSet <string>(); InstanceIDToComponentTypes(instanceID, types, m_ObjectTypes); currentHierarchyData.types = types; children.Add(currentHierarchyData); hasChanged = true; } else if (children[siblingIndex].index != instanceID) { currentHierarchyData = new HierarchyData(m_HierarchyProperty); var types = new HashSet <string>(); InstanceIDToComponentTypes(instanceID, types, m_ObjectTypes); currentHierarchyData.types = types; children[siblingIndex] = currentHierarchyData; hasChanged = true; } else { currentHierarchyData = children[siblingIndex]; InstanceIDToComponentTypes(instanceID, currentHierarchyData.types, m_ObjectTypes); } m_DataStack.Push(currentHierarchyData); m_SiblingIndexStack.Push(siblingIndex + 1); m_SiblingIndexStack.Push(0); lastDepth = currentDepth; } while (m_SiblingIndexStack.Count > 0 && m_DataStack.Count > 0) { if (CleanUpHierarchyData(m_DataStack.Pop(), m_SiblingIndexStack.Pop())) { hasChanged = true; } } if (hasChanged) { foreach (var list in m_HierarchyLists) { list.hierarchyData = GetHierarchyData(); } // Send new data to existing filterUIs foreach (var filterUI in m_FilterUIs) { filterUI.filterList = GetFilterList(); } } }
public HierarchyData(HierarchyProperty property) { template = k_TemplateName; name = property.name; instanceID = property.instanceID; }
public virtual bool Filter(string query, HierarchyProperty objectToFilter, UnityEditor.SearchService.ISearchContext context) { var id = objectToFilter.instanceID; return(m_SearchItems.Contains(id)); }
IEnumerator CreateFolderData(Action <FolderData, bool> callback, HashSet <string> assetTypes, bool hasNext = true, HierarchyProperty hp = null) { if (hp == null) { hp = new HierarchyProperty(HierarchyType.Assets); hp.SetSearchFilter("t:object", 0); } var name = hp.name; var guid = hp.guid.GetHashCode(); var depth = hp.depth; var folderList = new List <FolderData>(); var assetList = new List <AssetData>(); if (hasNext) { hasNext = hp.Next(null); while (hasNext && hp.depth > depth) { if (hp.isFolder) { yield return(StartCoroutine(CreateFolderData((data, next) => { folderList.Add(data); hasNext = next; }, assetTypes, hasNext, hp))); } else if (hp.isMainRepresentation) // Ignore sub-assets (mixer children, terrain splats, etc.) { assetList.Add(CreateAssetData(hp, assetTypes)); } if (hasNext) { hasNext = hp.Next(null); } // Spend a minimum amount of time in this function, and if we have extra time in the frame, use it if (Time.realtimeSinceStartup - m_ProjectFolderLoadYieldTime > k_MaxFrameTime && Time.realtimeSinceStartup - m_ProjectFolderLoadStartTime > k_MinProjectFolderLoadTime) { m_ProjectFolderLoadYieldTime = Time.realtimeSinceStartup; yield return(null); m_ProjectFolderLoadStartTime = Time.realtimeSinceStartup; } } if (hasNext) { hp.Previous(null); } } callback(new FolderData(name, folderList.Count > 0 ? folderList : null, assetList, guid), hasNext); }
public bool Filter(string query, HierarchyProperty objectToFilter) { using (new SearchSessionOptionsApplicator(m_Api, m_Options)) return(SceneSearch.Filter(query, objectToFilter, (SceneSearchContext)context)); }
internal static void Rename(this GameObject go) { var hWindow = WindowX.Hierarchy; if (Event.current != null && Event.current.keyCode == KeyCode.Escape) { renameGO = null; renameStep = 0; hWindow.Repaint(); return; } if (renameGO != go) { renameGO = go; renameStep = 2; } Debug.Log("Rename : " + go + ":" + renameStep); if (!IsRenaming()) { //not yet in edit name mode, try to do it now Selection.activeGameObject = go; #if UNITY_4_5 || UNITY_4_6 || UNITY_5 var treeView = WindowX.Hierarchy.xGetField("m_TreeView"); var data = treeView.xGetProperty("data"); var gui = treeView.xGetProperty("gui"); var item = data.xInvoke("FindItem", null, null, go.GetInstanceID()); if (item != null && gui != null) { gui.xInvoke("BeginRename", null, null, item, 0f); } #else var property = new HierarchyProperty(HierarchyType.GameObjects); property.Find(go.GetInstanceID(), null); hWindow.xInvoke("BeginNameEditing", TypeX.BaseProjectWindowT, null, go.GetInstanceID()); hWindow.xSetField("m_NameEditString", go.name, TypeX.BaseProjectWindowT); //name will be missing without this line hWindow.Repaint(); #endif } else { if (Event.current == null) { renameStep = 2; //Debug.Log("How can Event.current be null ?"); return; } if (Event.current.type == EventType.repaint && renameStep > 0) { renameStep--; //hWindow.Repaint(); } if (Event.current.type != EventType.repaint && renameStep == 0) { renameGO = null; } } //} }
public static extern DragAndDropVisualMode HierarchyWindowDrag(HierarchyProperty property, bool perform, InternalEditorUtility.HierarchyDropMode dropMode);
extern public static DragAndDropVisualMode ProjectWindowDrag(HierarchyProperty property, bool perform);
HierarchyData CollectHierarchyData(ref bool hasNext, ref bool hasChanged, HierarchyData hd, HierarchyProperty hp, HashSet <string> objectTypes) { var depth = hp.depth; var name = hp.name; var instanceID = hp.instanceID; var types = InstanceIDToComponentTypes(instanceID, objectTypes); List <HierarchyData> children = null; if (hp.hasChildren) { if (hd != null && hd.children == null) { hasChanged = true; } children = hd == null || hd.children == null ? new List <HierarchyData>() : hd.children; hasNext = hp.Next(null); var i = 0; while (hasNext && hp.depth > depth) { var go = EditorUtility.InstanceIDToObject(hp.instanceID); if (go == gameObject) { // skip children of EVR to prevent the display of EVR contents while (hp.Next(null) && hp.depth > depth + 1) { } // If EVR is the last object, don't add anything to the list if (hp.instanceID == 0) { break; } name = hp.name; instanceID = hp.instanceID; types = InstanceIDToComponentTypes(instanceID, objectTypes); } if (i >= children.Count) { children.Add(CollectHierarchyData(ref hasNext, ref hasChanged, null, hp, objectTypes)); hasChanged = true; } else if (children[i].index != hp.instanceID) { children[i] = CollectHierarchyData(ref hasNext, ref hasChanged, null, hp, objectTypes); hasChanged = true; } else { children[i] = CollectHierarchyData(ref hasNext, ref hasChanged, children[i], hp, objectTypes); } if (hasNext) { hasNext = hp.Next(null); } i++; } if (i != children.Count) { children.RemoveRange(i, children.Count - i); hasChanged = true; } if (children.Count == 0) { children = null; } if (hasNext) { hp.Previous(null); } } else if (hd != null && hd.children != null) { hasChanged = true; } if (hd != null) { hd.children = children; hd.name = name; hd.instanceID = instanceID; hd.types = types; } return(hd ?? new HierarchyData(name, instanceID, types, children)); }
extern public static DragAndDropVisualMode HierarchyWindowDrag(HierarchyProperty property, HierarchyDropMode dropMode, Transform parentForDraggedObjects, bool perform);
public static IEnumerable <HierarchyProperty> EnumerateAssets(HierarchyProperty property) { return(EnumerateAssets(property, p => p, p => true)); }
HierarchyData CollectHierarchyData(ref bool hasNext, ref bool hasChanged, HierarchyData hd, HierarchyProperty hp) { var depth = hp.depth; var name = hp.name; var instanceID = hp.instanceID; List <HierarchyData> list = null; list = (hd == null || hd.children == null) ? new List <HierarchyData>() : hd.children; if (hp.hasChildren) { hasNext = hp.Next(null); var i = 0; while (hasNext && hp.depth > depth) { var go = EditorUtility.InstanceIDToObject(hp.instanceID); if (go == gameObject) { // skip children of EVR to prevent the display of EVR contents while (hp.Next(null) && hp.depth > depth + 1) { } name = hp.name; instanceID = hp.instanceID; } if (i >= list.Count) { list.Add(CollectHierarchyData(ref hasNext, ref hasChanged, null, hp)); hasChanged = true; } else if (list[i].instanceID != hp.instanceID) { list[i] = CollectHierarchyData(ref hasNext, ref hasChanged, null, hp); hasChanged = true; } else { list[i] = CollectHierarchyData(ref hasNext, ref hasChanged, list[i], hp); } if (hasNext) { hasNext = hp.Next(null); } i++; } if (i != list.Count) { list.RemoveRange(i, list.Count - i); hasChanged = true; } if (hasNext) { hp.Previous(null); } } else { list.Clear(); } List <HierarchyData> children = null; if (list.Count > 0) { children = list; } if (hd != null) { hd.children = children; hd.name = name; hd.instanceID = instanceID; } return(hd ?? new HierarchyData(name, instanceID, children)); }
void OnGUI() { scrollPos = EditorGUILayout.BeginScrollView(scrollPos); SerializedObject serializedThis = new SerializedObject(this); selectedMap = Selection.activeGameObject; selectedTile = Selection.activeGameObject; EditorGUILayout.LabelField("Map Editor:", EditorStyles.boldLabel); EditorGUILayout.PropertyField(serializedThis.FindProperty("setupTiles"), new GUIContent("Setup Tiles"), true); if (GUILayout.Button("Toggle Grid")) { if (GameObject.Find("TempMapEditorGrid") != null) { DestroyImmediate(GameObject.Find("TempMapEditorGrid")); } else { HierarchyProperty prop = new HierarchyProperty(HierarchyType.GameObjects); GameObject gridObj = Instantiate(gridPrefab, new Vector3(0, 0, 0), Quaternion.Euler(90, 0, 0)); gridObj.name = "TempMapEditorGrid"; } } if (selectedTile != null) { if (Selection.activeGameObject.scene.name != null) { if (Selection.gameObjects.Length == 1) { if (selectedTile.GetComponent <Renderer>() != null) { if (selectedTile.GetComponent <MeshFilter>() != null) { EditorGUILayout.Separator(); EditorGUILayout.LabelField("Tile Editor:", EditorStyles.boldLabel); MeshFilter meshFilter = selectedTile.GetComponent <MeshFilter>(); Renderer renderer = selectedTile.GetComponent <Renderer>(); Material[] mat = renderer.sharedMaterials; if (meshFilter.sharedMesh.name.Contains("cliff") && mat.Length == 2) { mat[0] = (Material)EditorGUILayout.ObjectField("Cliff Mat", renderer.sharedMaterials[0], typeof(Material), false); } else if (meshFilter.sharedMesh.name.Contains("stair")) { mat[0] = (Material)EditorGUILayout.ObjectField("Stair Mat", renderer.sharedMaterials[0], typeof(Material), false); } bool found = false; if (mat.Length > 0) { for (int i = 0; i < mat.Length; i++) { if (found) { break; } for (int e = 0; e < castedPresets.Length; e++) { if (mat[i] != null) { if (mat[i].name == castedPresets[e]) { found = true; matInt = i; if (firstRun) { preset = (PresetTiles)e; } break; } } else { found = true; if (firstRun) { preset = PresetTiles.None; } } } if (!found) { if (firstRun) { preset = PresetTiles.None; } } } } if (preset == PresetTiles.None) { if (meshFilter.sharedMesh.name == "tile" && mat.Length == 1) { mat[0] = (Material)EditorGUILayout.ObjectField("Tile Mat", renderer.sharedMaterials[0], typeof(Material), false); } else if (meshFilter.sharedMesh.name.Contains("cliff") && mat.Length == 2) { mat[1] = (Material)EditorGUILayout.ObjectField("Overlay Mat", renderer.sharedMaterials[1], typeof(Material), false); } else if (meshFilter.sharedMesh.name == "stairDirt" && mat.Length == 2) { mat[1] = (Material)EditorGUILayout.ObjectField("Side Mat", renderer.sharedMaterials[1], typeof(Material), false); } } if (matInt < mat.Length && matInt >= 0) { if (!firstRun) { mat[matInt] = (Material)AssetDatabase.LoadAssetAtPath("Assets/MapCreation/Materials/" + castedPresets[(int)preset] + ".mat", typeof(Material)); } } if ((matInt < 0 || matInt >= mat.Length) || preset == PresetTiles.None) { matInt = EditorGUILayout.IntField("Mat Element", matInt); } firstRun = true; PresetTiles oldpreset = preset; if (meshFilter.sharedMesh.name != "stairRail") { preset = (PresetTiles)EditorGUILayout.EnumPopup("Tile Preset", preset); } if (oldpreset != preset) { firstRun = false; } if (selTile1 != null && mat != null) { if (selTile1.materials != null) { for (int i = mat.Length - 1; i < selTile1.materials.Length; i++) { mat[i] = selTile1.materials[i]; } } selTile1 = null; } if (setupTiles != null) { if (setupTiles.Length > 0) { if (GUILayout.Button("Select Setups")) { GenericMenu menu = new GenericMenu(); foreach (Tile tile in setupTiles) { AddTileItem1(menu, tile.name, tile); } menu.ShowAsContext(); } } } renderer.sharedMaterials = mat; } } else if (selectedTile.GetComponent <Footstep>() != null) { if (selTile2 != null) { if (selTile2.footstepSound == null) { selTile2 = null; } } Footstep footstep = selectedTile.GetComponent <Footstep>(); SerializedObject serializedObject = new SerializedObject(footstep); EditorGUILayout.Separator(); EditorGUILayout.LabelField("Footstep Editor:", EditorStyles.boldLabel); EditorGUILayout.PropertyField(serializedObject.FindProperty("walkClip"), new GUIContent("Footstep"), true); EditorGUILayout.PropertyField(serializedObject.FindProperty("gizmoColor"), new GUIContent("Gizmo Color"), true); EditorGUILayout.PropertyField(serializedObject.FindProperty("stepOnAnyObject"), new GUIContent("Any Object?"), true); if (selTile2 != null) { if (selTile2.footstepSound != null) { serializedObject.FindProperty("walkClip").objectReferenceValue = selTile2.footstepSound; } if (selTile2.footstepGizmo != null) { serializedObject.FindProperty("gizmoColor").colorValue = selTile2.footstepGizmo; } serializedObject.FindProperty("stepOnAnyObject").boolValue = selTile2.footstepAnyObject; } selTile2 = null; if (setupTiles != null) { if (setupTiles.Length > 0) { if (GUILayout.Button("Select Setups")) { GenericMenu menu = new GenericMenu(); foreach (Tile tile in setupTiles) { AddTileItem2(menu, tile.name, tile); } menu.ShowAsContext(); } } } serializedObject.ApplyModifiedProperties(); } EditorGUILayout.Separator(); if (selectedMap != null) { if (selectedMap.transform.parent != null) { selectedMap = selectedMap.transform.parent.gameObject; } EditorGUILayout.Separator(); if (selectedMap.GetComponent <MapCollider>() != null) { EditorGUILayout.LabelField("Map Collision:", EditorStyles.boldLabel); MapCollider mapCollider = selectedMap.GetComponent <MapCollider>(); if (GUILayout.Button("Generate Collision Mesh")) { mapCollider.shorthandCollisionMap = "0x4"; mapCollider.width = 2; mapCollider.length = 2; MapCompiler.Compile(selectedMap); } mapCollider.drawWireframe = EditorGUILayout.Toggle("Wireframe Gizmo", mapCollider.drawWireframe); mapCollider.wireframeColor = EditorGUILayout.ColorField("Wireframe Color", mapCollider.wireframeColor); } EditorGUILayout.Separator(); if (selectedMap.GetComponent <MapSettings>() != null) { EditorGUILayout.LabelField("Map Settings:", EditorStyles.boldLabel); MapSettings mapSettings = selectedMap.GetComponent <MapSettings>(); mapSettings.mapName = EditorGUILayout.TextField(new GUIContent("Map Name"), mapSettings.mapName); mapSettings.mapNameBoxTexture = (Sprite)EditorGUILayout.ObjectField("Map Name Box Sprite", mapSettings.mapNameBoxTexture, typeof(Sprite), false); mapSettings.mapNameColor = EditorGUILayout.ColorField("Map Name Color", mapSettings.mapNameColor); mapSettings.mapBGMClip = (AudioClip)EditorGUILayout.ObjectField("Map BGM", mapSettings.mapBGMClip, typeof(AudioClip), false); mapSettings.mapBGMNightClip = (AudioClip)EditorGUILayout.ObjectField("Map BGM 2", mapSettings.mapBGMNightClip, typeof(AudioClip), false); mapSettings.mapBGMLoopStartSamples = EditorGUILayout.IntField("Map BGM Loop Samples", mapSettings.mapBGMLoopStartSamples); mapSettings.mapBGMNightLoopStartSamples = EditorGUILayout.IntField("Map BGM 2 Loop Samples", mapSettings.mapBGMNightLoopStartSamples); EditorGUILayout.Space(); mapSettings.environment = (MapSettings.Environment)EditorGUILayout.EnumPopup("Map Environment", mapSettings.environment); mapSettings.environment2 = (MapSettings.Environment)EditorGUILayout.EnumPopup("Map Environment 2", mapSettings.environment2); mapSettings.pokemonRarity = (MapSettings.PokemonRarity)EditorGUILayout.EnumPopup("Pokémon Rarity", mapSettings.pokemonRarity); SerializedObject serializedObject = new SerializedObject(mapSettings); EditorGUILayout.PropertyField(serializedObject.FindProperty("encounters"), new GUIContent("Map Encounters"), true); serializedObject.ApplyModifiedProperties(); } } } else { EditorGUILayout.LabelField("Cannot process multiple selections!", EditorStyles.boldLabel); } } else { EditorGUILayout.LabelField("Cannot process non-scene objects!", EditorStyles.boldLabel); } } else { EditorGUILayout.LabelField("No tile selected!", EditorStyles.boldLabel); } serializedThis.ApplyModifiedProperties(); EditorGUILayout.EndScrollView(); }