Search Unity

  1. Click here to see what's on sale for the "Best of Super Sale" on the Asset Store
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Debug.developerConsoleVisible no longer returns true (ever) in the editor.

Discussion in 'Scripting' started by Dafeesh, Mar 12, 2015.

  1. Dafeesh

    Dafeesh

    Joined:
    Oct 21, 2013
    Posts:
    6
    So in unity 4.6 Debug.developerConsoleVisible used to return true on the frame that the console was accessible to be messed with (specifically to use Debug.ClearDeveloperConsole).

    Well, not in Unity5 it seems it no longer does this and I'm having a frustating time trying to do a very simple operation.

    Here is a simple snippet checking it:

    void Update()
    {
    if (Debug.developerConsoleVisible)
    Debug.Log("VISIBLE");
    }
    This stinks. Does anyone else have a solution to checking if a snippet can properly use Debug.ClearDeveloperConsole?
     
  2. hpjohn

    hpjohn

    Joined:
    Aug 14, 2012
    Posts:
    2,155
    In the past i have used reflection to clear the console, does it still work that way?
    Code (CSharp):
    1.     void ClearLog () {
    2.         Assembly assembly = Assembly.GetAssembly( typeof( SceneView ) );
    3.         System.Type type = assembly.GetType( "UnityEditorInternal.LogEntries" );
    4.         MethodInfo method = type.GetMethod( "Clear" );
    5.         UnityEngine.Object o = new UnityEngine.Object();
    6.         method.Invoke( o, null );
    7.     }
    8.  
     
unityunity