My code is
public class www : WWW
{
public www(string url):base(url){}
private bool _Used = false;
public bool Used
{
set
{
_Used = value;
}
get
{
return _Used;
}
}
}
private static IEnumerator _LoadBytes(string url, Action<string> GetString, Action<byte[]> GetBytes)
{
www rerquest = new www(url);
BackGroundEntry.debug += "_LoadBytes:" + url + "\n";
if (enable)
{
proList.Add(rerquest);
}
BackGroundEntry.debug += "_LoadBytes:1\n";
yield return rerquest;
BackGroundEntry.debug += "_LoadBytes:2\n";
try
{
BackGroundEntry.debug += "_LoadBytes:" + rerquest.error+ "\n";
if (rerquest.isDone)
{
if (GetBytes != null)
{
BackGroundEntry.debug += "_LoadBytes:4\n";
GetBytes(rerquest.bytes);
}
if (GetString != null)
{
BackGroundEntry.debug += "_LoadBytes:5\n";
BackGroundEntry.debug += "_LoadBytes:length:" + rerquest.bytes.Length + "\n";
BackGroundEntry.debug += "_LoadBytes:" + rerquest.data + "\n";
GetString(rerquest.data);
}
}
}
catch (Exception e) { }
finally
{
rerquest.Used = true;
if (!enable)
{
rerquest.Dispose();
rerquest = null;
}
}
}
It works well in edit mode,but I publish it as a web app, sometimes it doesn’t work,"rerquest.bytes.Length " is 0. Any solution?