override public void OnInspectorGUI() { if (serializedObject.isEditingMultipleObjects) { DrawDefaultInspector(); return; } serializedObject.Update(); atlasAsset = atlasAsset ?? (SpineSpriteAtlasAsset)target; if (atlasAsset.RegionsNeedLoading) { if (GUILayout.Button(SpineInspectorUtility.TempContent("Load regions by entering Play mode"), GUILayout.Height(20))) { EditorApplication.isPlaying = true; } } EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(atlasFile); EditorGUILayout.PropertyField(materials, true); if (EditorGUI.EndChangeCheck()) { serializedObject.ApplyModifiedProperties(); atlasAsset.Clear(); atlasAsset.GetAtlas(); atlasAsset.updateRegionsInPlayMode = true; } if (materials.arraySize == 0) { EditorGUILayout.HelpBox("No materials", MessageType.Error); return; } for (int i = 0; i < materials.arraySize; i++) { SerializedProperty prop = materials.GetArrayElementAtIndex(i); var material = (Material)prop.objectReferenceValue; if (material == null) { EditorGUILayout.HelpBox("Materials cannot be null.", MessageType.Error); return; } } if (atlasFile.objectReferenceValue != null) { int baseIndent = EditorGUI.indentLevel; var regions = SpineSpriteAtlasAssetInspector.GetRegions(atlasAsset.GetAtlas()); int regionsCount = regions.Count; using (new EditorGUILayout.HorizontalScope()) { EditorGUILayout.LabelField("Atlas Regions", EditorStyles.boldLabel); EditorGUILayout.LabelField(string.Format("{0} regions total", regionsCount)); } AtlasPage lastPage = null; for (int i = 0; i < regionsCount; i++) { if (lastPage != regions[i].page) { if (lastPage != null) { EditorGUILayout.Separator(); EditorGUILayout.Separator(); } lastPage = regions[i].page; Material mat = ((Material)lastPage.rendererObject); if (mat != null) { EditorGUI.indentLevel = baseIndent; using (new GUILayout.HorizontalScope()) using (new EditorGUI.DisabledGroupScope(true)) EditorGUILayout.ObjectField(mat, typeof(Material), false, GUILayout.Width(250)); EditorGUI.indentLevel = baseIndent + 1; } else { EditorGUILayout.HelpBox("Page missing material!", MessageType.Warning); } } string regionName = regions[i].name; Texture2D icon = SpineEditorUtilities.Icons.image; if (regionName.EndsWith(" ")) { regionName = string.Format("'{0}'", regions[i].name); icon = SpineEditorUtilities.Icons.warning; EditorGUILayout.LabelField(SpineInspectorUtility.TempContent(regionName, icon, "Region name ends with whitespace. This may cause errors. Please check your source image filenames.")); } else { EditorGUILayout.LabelField(SpineInspectorUtility.TempContent(regionName, icon)); } } EditorGUI.indentLevel = baseIndent; } if (serializedObject.ApplyModifiedProperties() || SpineInspectorUtility.UndoRedoPerformed(Event.current)) { atlasAsset.Clear(); } }