Last active
August 29, 2015 14:08
This file contains hidden or 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 UnityEngine; | |
using UnityEditor; | |
using System.Collections; | |
public class SpoopyEditor : EditorWindow { | |
static float hauntTime = 0; | |
static float hauntSpeed = .005f; | |
static bool haunting = false; | |
public Texture2D skeletons = (Texture2D) Resources.Load("spook/ghost.jpg", typeof(Texture2D)); | |
public SceneView scene = null; | |
de | |
public static void StartTheHaunt() | |
{ | |
EditorWindow.GetWindow(typeof(SpoopyEditor)); | |
haunting = true; | |
hauntTime = 0; | |
} | |
void OnGUI () { | |
// The actual window code goes here | |
Rect wholeBox = new Rect(0,0,skeletons.width, skeletons.height); | |
EditorGUI.DrawPreviewTexture(wholeBox, skeletons); | |
} | |
//Animate at a buttery smooth 100fps | |
void Update() | |
{ | |
if(haunting) | |
{ | |
hauntTime += hauntSpeed; | |
if(hauntTime > 3.14) | |
{ | |
hauntTime = 0; | |
haunting = false; | |
this.Close(); | |
} | |
if(skeletons) | |
{ | |
this.position = new Rect(hauntTime * 800, 200, skeletons.width, skeletons.height); | |
} | |
} | |
} | |
} | |
//Actually listens to the save command | |
public class SpoopyListener : UnityEditor.AssetModificationProcessor { | |
public static bool isSaving = true; | |
public static string[] OnWillSaveAssets(string[] paths) | |
{ | |
SpoopyEditor.StartTheHaunt(); | |
return paths; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
10/10 - Hands down the most useful editor plugin I've come across 👻