Layering images and moving them within an Editor Window... is it possible?

I’m putting together some custom Editor Windows and want to recreate a tool similar to this from RPG Maker:
189090-rpgmakerexample.png


This tool is for setting up Mobs in battle. You add enemies to the picture then can drag the individual enemies around to position them.

I know how to use EditorGUI.DrawPreviewTexture but is it possible to layer the image and then detect it’s X and Y position of the monster’s image within the background image?


My first thought is to update the Image Rect in OnGUI… but I’d need to detect mouse down and if it’s on an enemy image… I’m going to experiment with that idea, but any help would be appreciated.

Think I’ve figured it out.

So been playing around and yes you can layer images… although my transparent PNG is coming through as black. Not sure if this is because of the layering or because of how I’m getting the Texture… but yeah, I think I’ve worked out enough to get this working.

If anyone is interested, I used DrawPreviewTexture, and draw the background first, then I go through each enemy in the mob and draw them.

Then using Event.current.mousePosition, I can get the mouse position and mouseDown Event Type.

I’ve been able to detect if an enemy has been selected, and I can update the position of the enemy. Rest should be straight forward. Just need to sort out those black backgrounds…
189094-capture.png