I am working with an open source project called Project Porcupine. The project is a game engine for a base building game that allows for one to extend the game. We have a system to read texture files, and use a .XML configuration file to parse the details of that file. This to me seems like a good use case for a custom inspector. Unfortunately, I can't figure out how to even configure the script to read in images as such, and google is letting me down. How can I write a custom editor for an image, even better if limited to a folder? Thanks!


To clear things up a bit, I'm trying to make a custom inspector for images in the /StreamingAssets folder. These assets are included with the build, and thus editable in Unity, but I would like to make a tool to make editing these a bit easier. Right now the inspector looks like this, the problem I'm having is getting anything to appear on the inspector at all.

enter image description here

I've tried two things, first a Custom Inspector on TextureImporter, and using the following code, neither of which seemed to do anything. I would be happy to get anything printed in the Inspector, from that point I can figure out the rest, I hope. Thanks!

using UnityEditor;
using UnityEngine;

public class SpriteXmlViewer : AssetPostprocessor
    void OnPreprocessTexture()
        GUILayout.Label("Hello OnInspectorGUI!");

Lastly, I'm clicking on the following image for the display above:

enter image description here

  • \$\begingroup\$ It's not clear to me which step in the process you need help with. Is it in reading the image file from a folder path or URL using WWW.texture? Or setting up the inspector UI to assign & preview the texture? Or some other detail? Try editing your question to show us what you have so far, what your end goal is (eg. a mock-up image), and where you're stuck. \$\endgroup\$
    – DMGregory
    Oct 6, 2016 at 16:39
  • \$\begingroup\$ Setting up the inspector UI for setting up the texture. I'll add in a bit to help. \$\endgroup\$ Oct 6, 2016 at 16:56


You must log in to answer this question.

Browse other questions tagged .