Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
The Editor script for the ScenePaletteSwitcher.cs ( Is only working with the ColorPalettes 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 ()
myObj = target as ScenePaletteSwitcher;
if (myObj != null && myObj.PaletteData != null) {
GUILayout.Space (20);
drawColorPalette (myObj.PaletteData, true, false);
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
You can’t perform that action at this time.