Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

www.error handler

Discussion in 'Scripting' started by Rivomist, Mar 13, 2019.

  1. Rivomist

    Rivomist

    Joined:
    Oct 1, 2016
    Posts:
    9
    Good day! In our project we use asset bundles with AssetBundleManager offered by unity tutorials. It works perfect with a little exception, in coroutine if www contains any error it will throw an exception with string that contains error message.
    So I want to create an error handler, which would enable the panel with message according to what had happened. But I cant find anywhere what www.error could throw. Can anyone list the messages it can contain or a link with this info? The variant with passing this string to the panel text field aint work since we have many languages. Thanks for help.

    Here's the code we using just in case:

    Code (CSharp):
    1. using (WWW www = WWW.LoadFromCacheOrDownload(url, version))
    2.             {
    3.                
    4.                 while (!www.isDone)
    5.                 {
    6.                     txt.text = ((int)(www.progress * 100) + 10).ToString() + "%";
    7.                     img.fillAmount = www.progress + 0.1f;
    8.                     yield return null;
    9.                 }
    10.                 if (www.error != null)
    11.                 {
    12.                     ErrorEvent(www.error);
    13.                     throw new Exception("WWW download error:" + www.error);
    14.                 }
    15.                 //etc...
    16.             }
     
  2. Brathnann

    Brathnann

    Joined:
    Aug 12, 2014
    Posts:
    7,186

    Attached Files:

    • uwr.PNG
      uwr.PNG
      File size:
      40.4 KB
      Views:
      600
  3. Rivomist

    Rivomist

    Joined:
    Oct 1, 2016
    Posts:
    9