Author Topic: StarLink GameWebRequest  (Read 2620 times)

schellenberghq

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 31
  • Game Programmer
    • View Profile
    • Blog
StarLink GameWebRequest
« on: August 22, 2013, 11:00:07 AM »
Could someone give me a good example of how to use the GameWebRequest script. I've tried quite a few different ways to get it working.

I'm trying to use it to download a .png and assign it to a Texture2D variable.

Thanks

-Jacob S
---------------------------
Jacob S.
Game Programmer
---------------------------

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: StarLink GameWebRequest
« Reply #1 on: August 22, 2013, 11:44:22 AM »
WebRequest.Create(url, callback);

where "url" is your image such as http://somewebsite.com/abc.png, and "callback" is the function to call when it finishes downloading it.

schellenberghq

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 31
  • Game Programmer
    • View Profile
    • Blog
Re: StarLink GameWebRequest
« Reply #2 on: August 22, 2013, 12:57:13 PM »
Could you give me an example on how to retrieve the item that was downloaded?

The method is void, so I'm not sure on how I would assign the downloaded object (texture in my case) to a Texture2D variable.
---------------------------
Jacob S.
Game Programmer
---------------------------

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: StarLink GameWebRequest
« Reply #3 on: August 22, 2013, 01:19:24 PM »
Hmm, I just had a second look at that file... it's not going to help you download images. It's meant for data files. Just use the regular WWW download method to download images. DownloadTexture script comes with NGUI.