0
\$\begingroup\$

I have this script attached to a RawImage file in my games UI

public class DownloadImage : MonoBehaviour {
     string url = "http://megabrogames.rf.gd/pic.jpg";
     //string url = "https://i.imgur.com/xBSyvRx.jpg";

     IEnumerator Start () {
         WWW www = new WWW(url);
         yield return www;
         GetComponent<RawImage>().texture = www.texture;
     }
 }

Both jpg files are the same. One I uploaded to Imgur, this works. The other is on my own website. The url to my website works fine, I have checked in on two computers and several browsers.

All I get is the red question mark. But if I uncomment the other one instead it all works perfectly.

My problem is that I have hard-coded the url into the game, and I want to change the image each week. It has to be the same URL for that to work, but i think with Imgur it will auto assign whatever url it feels like.

thanks for any help

\$\endgroup\$

2 Answers 2

1
\$\begingroup\$

Looks like your URL is no good.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ yeah , I had changed it many times, even bought 3 domain names and tried different hosts. Turns out all the free hosts block the hotlinking of images so my game couldnt retrieve it. I solved it anyway by joining GithubPages.io // Much appreciate you checking it for me though \$\endgroup\$ Dec 22, 2017 at 16:39
0
\$\begingroup\$

OK, yes the URL is no good now because I have been fiddling about changing things since posting. But long story short, I tried 3 webhosts and they all blocked hotlinking so my game couldnt get the file. (NOTE: I only tried free hosting options)

Anyway, there was a far easier solution all the time.. i joined GithubPages and hosted a website on that domain which I have full control over. The game pulls the file from that server without issue.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .