Problem Assigning a Variable For WWW.LoadImageIntoTexture

This is the place to find out how to accomplish something specific with EZ Game Saver.

Problem Assigning a Variable For WWW.LoadImageIntoTexture

Postby giza » Fri May 04, 2012 9:53 pm

Hi Brady,

I'm having some difficulty loading a thumbnail via WWW LoadImageIntoTexture into my scene. I have set up a GameDataSaver on the script below that saves the String urlNew. The URL value urlNew is allocated correctly and loads into texture when I call the function theThumb (). However, at Start, although the urlNew is also saved correctly, I get the following message:
UnassignedReferenceException: The variable myThumbnail of 'thumbNail' has not been assigned.


Code: Select all
var myThumbnail : Texture2D;
var urlNew : String;

function Start(){
    var www = new WWW (urlNew);
    yield www;
    www.LoadImageIntoTexture(myThumbnail);
}

function theThumb () {
    var www = new WWW (urlNew);
    yield www; 
    www.LoadImageIntoTexture(myThumbnail);
}


Am I wrong in believing that the texture should also load at start? The URL value itself is correct so I don't understand why the www class can't simply take the saved urlNew value and then load the texture! The urlNew variable is set up from a different script in the standard way, e.g. file://C:/Users/.../GameSaverTest/Assets/Resources/thumbnail Object01 23 Metal - Brass Patterned.png. Is it the url name itself that is causing the problem?
giza
 
Posts: 10
Joined: Sun Apr 29, 2012 1:17 am

Re: Problem Assigning a Variable For WWW.LoadImageIntoTextur

Postby giza » Sat May 05, 2012 2:51 pm

OK, sorry, stupid me! I forgot to specify a new texture at start, i.e.
Code: Select all
myThumbnail = new Texture2D(90,90);
All sorted!
giza
 
Posts: 10
Joined: Sun Apr 29, 2012 1:17 am

Re: Problem Assigning a Variable For WWW.LoadImageIntoTextur

Postby valamun » Mon Apr 16, 2018 8:58 am

ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215
ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215
ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215
ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215
ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215
ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215
ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215
ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215
ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215
ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215
ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215ac23215
ac23215
valamun
 
Posts: 20840
Joined: Sat Mar 17, 2018 5:46 pm


Return to EZ Game Saver How to...

Who is online

Users browsing this forum: No registered users and 2 guests

cron