- Home /
Where is downloaded things from editor script being saved?
This script downloads a texture from the web. Does anyone know where it's saved to? I've looked in my project folders but I couldn't find it :(
// UnityScript
@script ExecuteInEditMode()
class MyWindow extends EditorWindow {
private var www : WWW;
var target : Renderer;
var texture : Texture2D;
@MenuItem ("Window/My Window")
static function ShowWindow () {
EditorWindow.GetWindow (MyWindow);
}
function OnGUI () {
if(GUILayout.Button("Download")){ LoadTexture("http://download.unity3d.com/webplayer/images/unity-icon-big.jpg"); }
texture = EditorGUI.ObjectField(Rect(3,60,200,20),"Add a Texture:",texture,Texture);
if(texture){
EditorGUI.DrawPreviewTexture(Rect(25,150,100,100),texture);
}
}
/*function OnEnable(){
LoadTexture("http://download.unity3d.com/webplayer/images/unity-icon-big.jpg");
}*/
function LoadTexture(url)
{
www = new WWW(url);
#if UNITY_EDITOR
if (!EditorApplication.isPlaying)
EditorApplication.update = MyUpdate;
else
WaitForDownload();
#else
WaitForDownload();
#endif
}
#if UNITY_EDITOR
function MyUpdate ()
{
if (www.isDone)
{
EditorApplication.update = null;
LoadCompleted();
}
}
#endif
function WaitForDownload()
{
yield www;
LoadCompleted();
}
function LoadCompleted()
{
//target.sharedMaterial.mainTexture = www.texture;
texture = www.texture;
}
}
Comment