Search Unity

Feature Request Writable Console

Discussion in 'Testing & Automation' started by Floris0106, Oct 25, 2020.

  1. Floris0106

    Floris0106

    Joined:
    Sep 8, 2018
    Posts:
    3
    I was debugging my code and watching some videos the other day, and saw a video on how to create a cheating console using UI to quickly iterate something. I came up with the idea that this would be even better if it were just in the editor console.

    For example: When writing a c# console program you have access to the Console class, which you can use to write to the console with Console.WriteLine() much like Debug.Log(), but there's also Console.ReadLine(), which reads the last line typed into the console. This takes control and thus freezes the main thread, so it wouldn't work like this in unity, but maybe there could be a MonoBehaviour message which passes a string whenever something is typed in the console. This would make for an amazing debugging tool, without having to make any UI. It's in my opinion also cleaner, because the console is in a seperate window.

    Also, this is better because it doesn't have to be removed when compiling if you don't want it to be in the final version, as the compiler can just ignore the MonoBehaviour message (if it isn't referred to by other code).
     
  2. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,338
    The editor console is not available in builds. If you're creating an editor console like what you're talking about - instead of just making menu items - it's probably because you want them in builds.
     
  3. Floris0106

    Floris0106

    Joined:
    Sep 8, 2018
    Posts:
    3
    No, the console I'm suggesting is for debugging purposes and not meant to be in a build. It could help iterating by allowing you to type a command and, for example, skip a cutscene, or skip forward to a certain part of gameplay.