Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

WWW returning non null error in 2017; but not 5.6.3

Discussion in '2017.1 Beta' started by AdbC99, Jun 15, 2017.

  1. AdbC99

    AdbC99

    Joined:
    Jan 18, 2012
    Posts:
    53
    This could be an intentional change rather than a bug; but when I do a GET using WWW the error response I used to get was NULL if it was successful and thats how I tested for errors, now on success the error is "" which could mean that there was just an error without a message.

    If this is an intentional change then it's made coding with WWW a little messier since you have to do these checks after a WWW:

    if (www.error == null) {
    ... /// Succeeded
    }
    else if (www.error.Length == 0) {
    ... /// Succeeded
    }
    else {
    ..../// Failed
    }
     
  2. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,736
    We are changing it back.
    However, it was always the case that the correct way to check for error is string.IsNullOrEmpty().