I have a question to ask whether Unity can actually call or instantiate images recently taken from the scene itself using the "Application.CaptureScreenshot" in a Build. I've already tried inside the editor to call the images from the screenshots using the "Resources.LoadAll" code, and it worked! Except for these 2 problems:-
- Newly taken snapshot is not imported into asset immediately and it requires the Unity to refresh its assets folder and may take a while.
- When build player, "Resources" folder is compiled (I think) and won't call objects outside the compiled folder. The images of the screenshot is stored at the "Resources" then "Texture" folder, but doesn't work like it did inside the editor.
I already checked the path inside data folder of the build, and confirm that it's correct. I just want to make sure that it is possible to do that in Unity. Please tell me whether it's possible or not. Thank You.
"You are trying to load data from a www stream which had the following error when downloading. Could not resolve host: C:; Host not found"
function Start ()
var go = new GameObject.CreatePrimitive(PrimitiveType.Cube);
//var Location = "http://mytutorblog.org/wp-content/uploads/2011/05/Prepare-for-a-test.jpg";
//var Location "C:\Documents and Settings\Administrator\Desktop\ScreenShot1.png"
var Location = Application.dataPath + "/Screenshots/" + "ScreenShot1.png";
go.renderer.material.mainTexture = new Texture2D(4, 4, TextureFormat.DXT1, false);
// Start a download of the given URL
var www = new WWW(Location);
// wait until the download is done
// assign the downloaded image to the main texture of the object
Jul 08 '11 at 04:58 AM