[Request] Add asset identification info to deserialization error messages

NodeCanvas Forums General Discussion [Request] Add asset identification info to deserialization error messages

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #15236
    fmechkak
    Participant

    Hi !

    In our project, we’ve had to refactor custom task/action/variable type names several times. The NC refactoring wizard helps, but still fails a lot. This leaves us with error messages in the console that describe the error itself (“Missing type”, “Unknown action”, etc.) but provide no information whatsoever on the graph causing the error.

    Selecting the error message in the console is of no help, since it doesn’t select the asset causing the problem.

    We’ve managed to improve the feedback by modifying Task.cs (see below, this is for 3.03), by adding the name of the prefab/asset before the error description. However, there are still two cases where no information is available:

    – when graph.agent is null. I don’t know what this corresponds to.

    – for missing type errors when deserializing a blackboard.

    The only solution is a full string search in the Assets directory for the name of the missing element. It works, but can be rather lengthy for large projects, especially since Unity seems to keep references to deleted components in some prefabs.

    If at all possible, I’d suggest prefixing ALL deserialization errors with the name of the object at the source of it. That would be the object path (or at least name) for bound graphs in a scene object, the prefab path (or name) for bound graphs in a prefab, or the asset path (or name) for stored graphs.

    The patch code in case anyone else wants more info in these types of error messages:

    public void Validate(ITaskSystem ownerSystem) {
    SetOwnerSystem(ownerSystem);
    OnValidate(ownerSystem);
    var hardError = GetHardError();
    if ( hardError != null ) {
    if (ownerSystem is Graph graph)
    {
    while (graph.parentGraph != null)
    graph = graph.parentGraph;
    Logger.LogError((graph.agent == null ? graph.name : graph.agent.name) + ” – ” + hardError, LogTag.VALIDATION, this);
    }
    else
    Logger.LogError(hardError, LogTag.VALIDATION, this);
    }
    }

    #15237
    fmechkak
    Participant

    Sorry for the ugly code above, no idea of you post pre-formatted text on this forum.

    #15260
    Gavalakis
    Keymaster

    Hello there,

    Please note that any errors logged in the Graph Console, are clickable and will both select the relevant Unity object, as well as open up the Graph Editor to focus on the related node that caused the error (or any other log). This only works within the custom Graph Console however and not from within the Unity Console. Have you tried using the Graph Console please?
    Let me know!
    Thanks!

    Join us on Discord: https://discord.gg/97q2Rjh

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.