Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.