How to use an Image(PNG) and GUISkin inside a dll ?

Hi every one, I made a tool with a custom editor (buttons, frames, GUISkin, etc.) and compiled my tool into a dll (with Monodevelop), but, when I try to put the guiskin and the images, I can’t use that inside the dll, I’m new about dll compilation and I don’t understand many things, even I find some info about how to put and use resources into a dll but I get some errors like: can’t convert -System.IO- to -Unityengine.Texture2D-, any help will be appreciated, thanks in advance.

Code Sample:

using System;
using UnityEngine;
using UnityEditor;
using System.IO;
using System.Reflection;
//
public class MyTool : EditorWindow
{
    Texture2D images;
    GUISkin mySkin;
    Assembly myAssembly;
    Stream imageStream;
    //
    static void Init()
    {
        // Draw the window.
    }
    //
    void OnEnable ()
    {
        myAssembly = Assembly.GetExecutingAssembly();
        images = myAssembly.GetManifestResourceStream("Images.Data.Button.png");
    }
    void OnGUI ()
    {
        GUI.skin = mySkin; // Here, I don't know how to search for the *.guiskin file inside the dll.
        GUI.Button(Rect(0, 0, 32, 32), images);
    }
}

Unity uses their own AssetDatabase to handle all kind of assets, in the editor as well as at runtime. Things like GUISkins are stored in a custom format and can’t be serialized into a custom format. Assets can only be used when they are inside the Assets folder.

However, you can load external images (only jpg and png) with Texture2D.LoadImage. All other assets need to be imported into the assetdatabase by Unity. From an editor script you can use the AssetDatabase to access and use any asset in the project.

If you made a custom editor you usually create a unitypackage by exporting all relevant stuff. When the user imports the package, all contained assets will be at the same relative position inside the Assets folder.

Compiling editor extensions into a .NET assembly is quite common but not necessary. Well it helps to protect the scripts from being altered accidentally. It does not save the code from being copied by others. .NET assemblies can easily decompiled since that’s even a feature of the language itself.