11using System ;
22using System . Collections . Generic ;
3- using UnityEditor ;
43using UnityEngine ;
4+ #if UNITY_EDITOR
5+ using UnityEditor ;
6+ #endif
57
68namespace Consolation
79{
@@ -38,6 +40,9 @@ public class Console : MonoBehaviour
3840 [ SerializeField , Tooltip ( "Number of logs to keep before removing old ones." ) ]
3941 int maxLogCount = 1000 ;
4042
43+ [ SerializeField , Tooltip ( "Whether log messages are collapsed by default or not." ) ]
44+ bool collapseLogOnStart ;
45+
4146 [ SerializeField , Tooltip ( "Font size to display log entries with." ) ]
4247 int logFontSize = 12 ;
4348
@@ -117,6 +122,11 @@ void Start()
117122 {
118123 isVisible = true ;
119124 }
125+
126+ if ( collapseLogOnStart )
127+ {
128+ isCollapsed = true ;
129+ }
120130 }
121131
122132 void Update ( )
@@ -430,6 +440,7 @@ class ConsoleEditor : Editor
430440 SerializedProperty toggleThresholdSeconds ;
431441 SerializedProperty restrictLogCount ;
432442 SerializedProperty maxLogCount ;
443+ SerializedProperty collapseLogOnStart ;
433444 SerializedProperty logFontSize ;
434445 SerializedProperty scaleFactor ;
435446
@@ -443,6 +454,7 @@ void OnEnable()
443454 toggleThresholdSeconds = serializedObject . FindProperty ( "toggleThresholdSeconds" ) ;
444455 restrictLogCount = serializedObject . FindProperty ( "restrictLogCount" ) ;
445456 maxLogCount = serializedObject . FindProperty ( "maxLogCount" ) ;
457+ collapseLogOnStart = serializedObject . FindProperty ( "collapseLogOnStart" ) ;
446458 logFontSize = serializedObject . FindProperty ( "logFontSize" ) ;
447459 scaleFactor = serializedObject . FindProperty ( "scaleFactor" ) ;
448460 }
@@ -469,6 +481,7 @@ public override void OnInspectorGUI()
469481 EditorGUILayout . PropertyField ( maxLogCount ) ;
470482 }
471483
484+ EditorGUILayout . PropertyField ( collapseLogOnStart ) ;
472485 EditorGUILayout . PropertyField ( logFontSize ) ;
473486 EditorGUILayout . PropertyField ( scaleFactor ) ;
474487 serializedObject . ApplyModifiedProperties ( ) ;
0 commit comments