- Home /
Calling function in another script dying without error
This one has me pretty baffled.
I'm looking to have a LoaderManager class as Singleton that handles all my loading for external assets. Making calls its public functions works properly as I show in test() below.
But when I attempt to do a load of an asset via WWW and yield, it appears to die completely and without any error.
// Main Script function Start () {
// this works test( "test string" );
// this identical function works too on LoaderManager
LoaderManager.GetInstance().test( "test string" );
// this works
loadURL("http://sm.local/assetManifest.json");
// this identical function on LoaderManager DOESN'T work
LoaderManager.GetInstance().loadURL("http://sm.local/assetManifest.json");
}
public function test( passedString:String ){ Debug.Log("local test() called -- passedString:"+passedString); } public function loadURL( url:String ){ Debug.Log("local loadAsset -- url:"+url); var www : WWW = new WWW (url);
yield www;
Debug.Log("local loadAsset Completed");
}
///////////////////////////////////////////////////////////////////////////////
// Loader Manager Script
class LoaderManager {
private static var Instance : LoaderManager=new LoaderManager();
public static function GetInstance(): LoaderManager
{
return Instance;
}
private function LoaderManager()
{
if(Instance!=null)
{
Debug.Log("this a singleton class, use MySingletonInstance.GetInstance() instead");
}
}
public function test( passedString:String ){
Debug.Log("LoaderManager test() called -- passedString:"+passedString);
}
public function loadURL( url:String ){
Debug.Log("LoaderManager loadAsset -- url:"+url);
var www : WWW = new WWW (url);
yield www;
Debug.Log("LoaderManager loadAsset Completed");
}
}
Again, these functions are identical on both the local and LoaderManager class. Why would it die and without error on the loadURL() call?
Your answer
Follow this Question
Related Questions
Yield And Return 2 Answers
Trying to create a static class for WWW-based functions and such 0 Answers
Custom yield return 1 Answer
How to set timer for WWW helper? 1 Answer