Resources.Load() and updating a texture...

So, I am using Resources.Load() to load a texture into a standalone application at runtime. My understanding was that this texture would come in fresh and could be used in the project, the key term there is fresh. Now, if I exit out of the game alter the texture and run the game again, the updated texture is not reflected and the original texture is what is present.

Is this expected functionality? If so, is there a way with a standalone to load truly external textures?

Thanks for the help!

– Clint

Yes; the Resources class is just another way to access objects from within your project (the docs on Resources explains some of this).

–Eric

If you want to duplicate a texture just use Instantiate, really instantiate works with any type of object.

Thanks for the input but I don’t think I phrased the question properly. :slight_smile:

I also don’t think I am understanding what Resources.Load() is exactly doing. My thought was using Resources.Load() I could load an external texture that may not be included in the project at runtime. I am guessing my thought is wrong about this but that the items are a part of the project just not part of the hierarchy.

If this is the case, is there a way to load external textures at runtime for a standalone application.

Regards,

– Clint

No, only from the web player. I asked a similar question just a few days ago, this thread may help:

http://forum.unity3d.com/viewtopic.php?t=4397

Thanks bigkahuna, sorry I missed the post I have been offline for a couple days and hadn’t had a chance to catch up on the posts up there. :slight_smile:

Regards,

– Clint

You can load external textures from an URL using the WWW class. This works in both the standalone and the web player.

Yes, but you can -only- load through an internet connection, not locally from your hard drive… :cry:

Possibly stupid question, since I haven’t tried this: can you not use file: instead of http: ?

–Eric

I asked the same question and was told “no”.

Indeed…“libcurl was built with FILE disabled!” Heh. :wink: Oh well…

–Eric

We will support loading files with the WWW class from the hard drive in a later version.

Certainly good information! :slight_smile:

Looking forward to the support in a later version!

Regards,

– Clint

If someone has a pressing need for this, simply include the textures in a raw format (a series of RGB values for example), and then load them by using System.IO.File and the procedural texture interface:

http://unity3d.com/Documentation/ScriptReference/Texture2D.html

Wouldn’t require a lot of code to get done, and you get the ability to load (and save) textures locally.

d.

Is there a way to store Textures/Assets dowloaded with the WWW class in the “Resources Directory” of a compiled unity app, or other location, that would be accesable via script at runtime.

I would like to :

if(!texture) {
Resources.Load(“texturename”);
}
if(!texture) { // if not found in resources
www = WWW(“http://urlOfTexture”);
texture = www.texture;
}
At this point I would like to “cache” the texture in the resources directory
so when the script runs again the texture will be found in the resources.

That would be cool. Now say you wanted to change the WWW texture2d, you might want to be able to copy over and delete the origionally downloaded texture too.
I sooo hope loading textures from a local HD will be a Unity1x release…?
AC