Created
February 16, 2017 09:19
-
-
Save DomDomHaas/971351d3be4bf5e7a7a184eaf5a196fa to your computer and use it in GitHub Desktop.
The Editor script for the ScenePaletteSwitcher.cs (https://gist.github.com/DomDomHaas/518d60d388bc593b2ffa5975abb9172b Is only working with the ColorPalettes u3d.as/bFr extension)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Linq; | |
using System.Reflection; | |
using UnityEditor; | |
using UnityEditor.SceneManagement; | |
using UnityEngine; | |
#pragma warning disable 3009 | |
namespace MrWhaleGames.ColorPalette | |
{ | |
[CustomEditor (typeof (ScenePaletteSwitcher))] | |
public class ScenePaletteSwitcherInspector : PaletteInspector | |
{ | |
#region Fields | |
private ScenePaletteSwitcher myObj; | |
#endregion Fields | |
#region Methods | |
public void OnEnable () | |
{ | |
myObj = target as ScenePaletteSwitcher; | |
} | |
public override void OnInspectorGUI () | |
{ | |
DrawDefaultInspector(); | |
myObj = target as ScenePaletteSwitcher; | |
if (myObj != null && myObj.PaletteData != null) { | |
GUILayout.Space (20); | |
drawColorPalette (myObj.PaletteData, true, false); | |
GUILayout.Space(5); | |
if (GUILayout.Button("Apply Palette to Scene")) { | |
myObj.SwitchAllPalettes (); | |
EditorSceneManager.SaveCurrentModifiedScenesIfUserWantsTo (); | |
} | |
} | |
} | |
#endregion Methods | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment