Search Unity

Feedback Why Console Window Sucks?

Discussion in 'Editor & General Support' started by sepnax, Sep 30, 2022.

  1. sepnax

    sepnax

    Joined:
    Jun 24, 2014
    Posts:
    6
    Console Window
    It is the main way for a coder working on C# to debug Unity games provided by unity.
    So why does it suck so much?
    • Search sucks because you can't see the context of message
    • Clearing the search filter also clears your current position in the logs, because f*** you.
    • No regex support
    • No even API for someone who wants to make their life in Unity easier.
     
  2. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    5,808
    No, that would be the debugger.

    There are plenty of assets in the store "enhancing" the console.

    There are also way-better-than-Visual-Studio IDEs that can show the Unity console output right in the IDE.

    The Console output is written to a .log (text) file that - if you really have to - you can analyze with a tool of your choice, even a program you wrote yourself, and that's where you can get nasty with Regex.

    Honestly, I think you may be logging too much and/or with not enough care for formatting and categorizing log statements if you need to use regex to find what you're looking for. If you can provide some examples we may be able to give you a couple tips.
     
    Kurt-Dekker likes this.
  3. Neto_Kokku

    Neto_Kokku

    Joined:
    Feb 15, 2018
    Posts:
    1,751
    We didn't even have search filtering until Unity 2019. Losing the selection when clearing the filter is indeed infuriating.

    And there are legitimate reasons for logging over the C# debugger:

    - If you're debugging multiplayer you definitely don't want to pause the game on a breakpoint most of the time.
    - Breakpoints can only show current state, not past state. Sometimes you need to see what did/didn't happen before a specific bug manifested to understand what led to it.

    Also, the console window can "ping" relevant objects in the scene and supports rich text formatting (helps in spotting specific types of messages in a sea of log spam when used properly), something you don't get from IDE log output.
     
  4. sepnax

    sepnax

    Joined:
    Jun 24, 2014
    Posts:
    6
    As Neto_Kokku said I indeed happen to work with multiplayer game. You can't break point or even pause the unity editor as causes off sync with the client and server, which could cause other problems and obfuscate more the scenario.
    To cope we have automated integration tests that test certain functionality.
    Often when a bug occurs you want to establish a timeline of events, here it would be very much useful to have better thought out search functionality for the logs.
    Currently the search only tells you whether you find anything with a certain search, nothing about the context and no regex support for queries like"test started |enemy attack| test fail".
    Editors log files tend to get quite massive and it is quite burden some UX to open up external software for this.
    True. But I find it no excuse for unity to be so lacking on this field. Most of them also are binaries so you then you have the issue of trusting them, also you cannot extend them yourself and on top of that the cost.

    I was able to using the reflection show the position of a row in the console but it got very ugly, but anyways I guess Ill continue to cope with the problem.
    The console is seemingly minor thing but affects all of us.

    upload_2022-10-1_13-43-54.png
     
  5. Neto_Kokku

    Neto_Kokku

    Joined:
    Feb 15, 2018
    Posts:
    1,751
    By the way, since ultimately we have to parse output log from files anyway, here are some tricks to make it easier:

    - Add easy to search/filter "tags" or "categories" to your messages so you can more easily find all messages that came from a specific class, or from a specific group of classes. Using things like #tagname or [tagname] allow you to keep having call stack lines show up in your search results.
    - Add the transform/component's GetInstanceId() to your messages to make it easier to get all messages which relate to a specific object instance. This helps a lot in multiplayer or AI debugging, allowing you to see the timeline of events for a specific object.
    - Write a custom logger class that wraps Unity's and add the features above do its API, so you don't have to spend time adding all that stuff manually to your messages. For example, you can extract type name from the passed context object and add it as a tag, automatically append its GetInstanceId, create strongly typed log categories (which make it easier to find in code), etc.
     
    Kurt-Dekker likes this.