Skip to content

Instantly share code, notes, and snippets.

@DomDomHaas
Created February 16, 2017 09:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DomDomHaas/971351d3be4bf5e7a7a184eaf5a196fa to your computer and use it in GitHub Desktop.
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)
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