public override void OnGetGraphic(ImagePackage package, FilePath path)
        {
            // Already resized?
            ResizedImage resized = ResizedImages.Get(path.Path);

            if (resized != null)
            {
                // Sure is!
                package.GotGraphic(resized.Image);

                return;
            }

            if (Callback.WillDelay)
            {
                // Buffer this call until later - we're not on the main thread.

                // Create the callback:
                ResourcesProtocolCallback callback = new ResourcesProtocolCallback(package, path);

                // Hook up the protocol handler for speed later:
                callback.Protocol = this;

                // Request it to run:
                callback.Go();

                return;
            }

            if (path.Filetype == "spa")
            {
                // Animated.

                // Load the binary file - Note: the full file should be called file.spa.bytes for this to work in Unity.
                byte[] binary = ((TextAsset)Resources.Load(path.Path)).bytes;

                if (binary != null)
                {
                    // Apply it now:
                    package.GotGraphic(new SPA(path.Url, binary));
                    return;
                }
            }
            else
            {
                // Image
                Texture2D image = (Texture2D)Resources.Load(path.Directory + path.Filename);

                // Resize the image:
                resized = ResizedImages.Add(path.Path, image);

                if (image != null)
                {
                    package.GotGraphic(resized.Image);
                    return;
                }
            }

            package.GotGraphic("Image not found in resources (" + path.Directory + path.Filename + " from URL '" + path.Url + "').");
        }
        public override void OnGetGraphic(ImagePackage package)
        {
            // Already resized?
            ResizedImage resized = ResizedImages.Get(package.location.Path);

            if (resized != null)
            {
                // Sure is!
                package.GotGraphic(resized.Image);

                return;
            }

            // Main thread only:
            Callback.MainThread(delegate(){
                // Try loading from resources:
                string resUrl = package.location.Directory + package.location.Filename;

                if (resUrl.Length > 0 && resUrl[0] == '/')
                {
                    resUrl = resUrl.Substring(1);
                }

                // Get the image:
                UnityEngine.Object resource = Resources.Load(resUrl);

                if (resource == null)
                {
                    // Note: the full file should be called something.bytes for this to work in Unity.
                    resource = Resources.Load(package.location.Path);
                }

                if (!package.Contents.LoadFromAsset(resource, package))
                {
                    return;
                }

                PictureFormat pict = package.Contents as PictureFormat;

                if (pict != null)
                {
                    // Resize the image:
                    resized = ResizedImages.Add(package.location.Path, pict.Image as Texture2D);

                    // Apply:
                    pict.Image = resized.Image;
                }

                // Great, stop there:
                package.Done();
            });
        }