I am trying to build an application that lets you change add and remove textures (allowing for a variable amount of images) after building the executables for Mac and Windows.
Here is the code, which works fine when adding images to the Resources folder within Unity:
#pragma strict
var texture : Texture2D;
var textures : Object[];
var i : int = 0;
function Start () {
textures = Resources.LoadAll("Textures",Texture2D);
texture = textures*;*
renderer.material.mainTexture = texture;
}
function Update () {
- if(Input.GetKeyUp(“o”)){*
-
if(i == textures.Length - 1)*
-
i = 0;*
-
else*
-
i ++;*
_ texture = textures*;_
_ renderer.material.mainTexture = texture;_
_ }_
_ if(Input.GetKeyUp(“i”)){_
_ if(i == 0)_
_ i = textures.Length - 1;_
_ else*_
* i --;*
_ texture = textures*;
renderer.material.mainTexture = texture;
}
}*
I would like to be able to make this work the same way after the executables have been built. For example, I could use the www class and load something from a folder next to (same path as) the executable. But I don’t know how to do the equivalent with the www class. Specifically, loadAll() and then make an array from that.
Any hints?
Thanks!_