x


Loading a www texture makes my game freeze for a second

I'm trying to load a texture via WWW dynamically. I am setting the url variable and then calling the following Coroutine. The code works, but when the texture is set to the www result then the game freezes for about a second (I'm assuming while the texture is applied). Is there a way I can prevent this from happening.. perhaps by loading the texture into memory first or something?

Of note: the texture is 4096 x 2048 and is about 715k in size. I've tried doing the same with a texture 1/4 the size and it still freezes, just for a shorter period of time.

IEnumerator LoadMapLarge() {
    WWW www = new WWW(url);
    yield return www;
    renderer.material.mainTexture = www.texture;
}
more ▼

asked Apr 05 '12 at 11:12 PM

emorobot gravatar image

emorobot
48 4 6 7

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

0 answers: sort voted first
Be the first one to answer this question
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:

x2190
x524
x230
x177
x11

asked: Apr 05 '12 at 11:12 PM

Seen: 431 times

Last Updated: Apr 05 '12 at 11:12 PM