x


WWW and Web Player

Currently I'm having problems getting this working in the Web Player. Please note this is working on the windows build. Does the WWW function work with the Web Player?

Also, putting this line of code in a c# script

string url = "http://www.google.com";
WWW www = new WWW(url);

while (!www.isDone) {}  // --- I don't think this ever returns because it locks my browser.

How can I do a web request in a browser?

thanks, stringa

more ▼

asked Aug 13 '10 at 07:33 PM

stringa gravatar image

stringa
257 37 39 42

(comments are locked)
10|3000 characters needed characters left

2 answers: sort voted first

use the example posted here: http://unity3d.com/support/documentation/ScriptReference/WWW.html

// Get the latest webcam shot from outside "Friday's" in Times Square
var url = "http://images.earthcam.com/ec_metros/ourcams/fridays.jpg";
function Start () {
     // Start a download of the given URL
    var www : WWW = new WWW (url);

    // Wait for download to complete
    yield www;

    // assign texture
    renderer.material.mainTexture = www.texture; 
}

"You should not write loops that spin until download is done".

more ▼

answered Dec 07 '10 at 09:17 PM

diabloroxx gravatar image

diabloroxx
689 5 7 12

(comments are locked)
10|3000 characters needed characters left

I found the Coroutine code elsewhere in the Answers.

more ▼

answered Aug 13 '10 at 08:08 PM

stringa gravatar image

stringa
257 37 39 42

This isn't an answer, edit it with a link to the solution

Sep 26 '10 at 07:43 PM spinaljack

Yes, if you answer your own questions, please help the community back with your own discoveries too. Thats how we all benefit from helping for free.

Dec 05 '10 at 02:41 AM BerggreenDK
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x831
x548

asked: Aug 13 '10 at 07:33 PM

Seen: 1456 times

Last Updated: Sep 26 '10 at 07:42 PM