Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

www.error handler

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

  1. Rivomist

    Rivomist

    Joined:
    Oct 1, 2016
    Posts:
    8
    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:
    4,692

    Attached Files:

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

    Rivomist

    Joined:
    Oct 1, 2016
    Posts:
    8