From ed573bea17e04f5e0fd8fa7f8fd69ed7a8ce34d0 Mon Sep 17 00:00:00 2001 From: Tomas Date: Fri, 20 Nov 2026 16:58:02 +0200 Subject: [PATCH 1/4] Replace Scroll dropdown with an Auto Scroll toggle button The Disabled / Scroll To End / Auto dropdown was confusing, since Scroll To End only differed from Auto by locking the scrollbar. It's now a single toggle button which shows whether new messages are followed: scrolling up or keyboard selection turns it off, scrolling to the last message or clicking it turns it back on. Co-Authored-By: Claude Opus 5.5 --- com.unity.mobile.android-logcat/CHANGELOG.md | 4 + .../Editor/AndroidLogcatAutoScroll.cs | 20 --- .../Editor/AndroidLogcatAutoScroll.cs.meta | 11 -- .../Editor/AndroidLogcatConsoleWindow.cs | 2 - .../Editor/AndroidLogcatMessagesViews.cs | 94 +++++-------- .../Editor/AndroidLogcatStyles.cs | 1 + .../Editor/AndroidLogcatUserSettings.cs | 7 +- .../Editor/Textures/DownArrowToLine.png | Bin 0 -> 918 bytes .../Editor/Textures/DownArrowToLine.png.meta | 130 ++++++++++++++++++ 9 files changed, 171 insertions(+), 98 deletions(-) delete mode 100644 com.unity.mobile.android-logcat/Editor/AndroidLogcatAutoScroll.cs delete mode 100644 com.unity.mobile.android-logcat/Editor/AndroidLogcatAutoScroll.cs.meta create mode 100644 com.unity.mobile.android-logcat/Editor/Textures/DownArrowToLine.png create mode 100644 com.unity.mobile.android-logcat/Editor/Textures/DownArrowToLine.png.meta diff --git a/com.unity.mobile.android-logcat/CHANGELOG.md b/com.unity.mobile.android-logcat/CHANGELOG.md index 6d760ea1..425b7db4 100644 --- a/com.unity.mobile.android-logcat/CHANGELOG.md +++ b/com.unity.mobile.android-logcat/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this package will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [Unreleased] +### Fixes & Improvements + - Replaced the Scroll dropdown (Disabled / Scroll To End / Auto) below the message log with an Auto Scroll toggle button. Turning it on scrolls to the last message and keeps following new ones. Scrolling up or selecting messages with the Up and Down keys turns it off, and scrolling back to the last message turns it back on. + ## [1.5.0] - 2026-11-18 ### Fixes & Improvements - Unity 6.0 or later is required. diff --git a/com.unity.mobile.android-logcat/Editor/AndroidLogcatAutoScroll.cs b/com.unity.mobile.android-logcat/Editor/AndroidLogcatAutoScroll.cs deleted file mode 100644 index 51297b78..00000000 --- a/com.unity.mobile.android-logcat/Editor/AndroidLogcatAutoScroll.cs +++ /dev/null @@ -1,20 +0,0 @@ -namespace Unity.Android.Logcat -{ - internal enum AutoScroll - { - /// - /// No automatic scrolling - /// - Disabled, - - /// - /// Always scroll to end - /// - ScrollToEnd, - - /// - /// Automatically scroll to end when manually moving to the end of messages - /// - Auto - } -} diff --git a/com.unity.mobile.android-logcat/Editor/AndroidLogcatAutoScroll.cs.meta b/com.unity.mobile.android-logcat/Editor/AndroidLogcatAutoScroll.cs.meta deleted file mode 100644 index 06d7cdd7..00000000 --- a/com.unity.mobile.android-logcat/Editor/AndroidLogcatAutoScroll.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: ddcea8abbb3e35b459d73e41506a0bd0 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/com.unity.mobile.android-logcat/Editor/AndroidLogcatConsoleWindow.cs b/com.unity.mobile.android-logcat/Editor/AndroidLogcatConsoleWindow.cs index 8ada6f48..418ea247 100644 --- a/com.unity.mobile.android-logcat/Editor/AndroidLogcatConsoleWindow.cs +++ b/com.unity.mobile.android-logcat/Editor/AndroidLogcatConsoleWindow.cs @@ -478,8 +478,6 @@ private void DoDebuggingGUI() } m_Logcat?.DoDebuggingGUI(); - if (m_Runtime.UserSettings.AutoScroll == AutoScroll.Auto) - GUILayout.Label($"Auto Scrolling: {m_ScrollData.PerformScrollWhileInAuto}"); // Have a sane number which represents that we cannot keep up with async items in queue // Usually this indicates a bug, since async operations starts being more and more delayed const int kMaxAsyncItemsInQueue = 100; diff --git a/com.unity.mobile.android-logcat/Editor/AndroidLogcatMessagesViews.cs b/com.unity.mobile.android-logcat/Editor/AndroidLogcatMessagesViews.cs index 90044d57..5c74c94a 100644 --- a/com.unity.mobile.android-logcat/Editor/AndroidLogcatMessagesViews.cs +++ b/com.unity.mobile.android-logcat/Editor/AndroidLogcatMessagesViews.cs @@ -11,24 +11,6 @@ namespace Unity.Android.Logcat { internal partial class AndroidLogcatConsoleWindow { - private GUIContent kScroll = new GUIContent(L10n.Tr("Scroll:"), L10n.Tr("Disabled - No scrolling\nScroll To End - Always scroll to end\nAuto - switch to 'scroll to end' when scrolling to the last message")); - class ScrollData - { - public int ScrollToItemWhileInDisabled { set; get; } - public bool PerformScrollWhileInAuto { set; get; } - - public ScrollData() - { - Reset(); - } - - public void Reset() - { - ScrollToItemWhileInDisabled = -1; - PerformScrollWhileInAuto = true; - } - } - // Extra message count ensures that there's an empty space below when we scrolling all the way down // This way it's easier to see that there's no more messages internal const int kExtraMessageCount = 5; @@ -83,7 +65,7 @@ public IReadOnlyList GetSelectedFilteredEntries(out int minIndex, o public IReadOnlyList SelectedFilteredEntries => GetSelectedFilteredEntries(out var minIndex, out var maxIndex); - private ScrollData m_ScrollData = new ScrollData(); + private int m_ScrollToItem = -1; private float doubleClickStart = -1; void CollectTagPrioritiesFromDevice() @@ -401,51 +383,40 @@ private bool DoGUIEntries() var controlId = GUIUtility.GetControlID(FocusType.Keyboard); var scalar = (float)(kExtraMessageCount + FilteredEntries.Count) / totalWindowRect.height; - switch (m_Runtime.UserSettings.AutoScroll) + var scrollToItem = m_ScrollToItem; + if (scrollToItem >= 0) { - case AutoScroll.Disabled: - var scrollToItem = m_ScrollData.ScrollToItemWhileInDisabled; - if (scrollToItem >= 0) - { - // Do the scrolling in repain event since maxVisibleItems depends on visibleWindowRect - // And that one is calculated correctly only in Repaint event - if (e.type != EventType.Repaint) - break; - - int minVisible = (int)(m_ScrollPosition.y * scalar); - int maxVisible = minVisible + maxVisibleItems; + // Do the scrolling in repain event since maxVisibleItems depends on visibleWindowRect + // And that one is calculated correctly only in Repaint event + if (e.type == EventType.Repaint) + { + int minVisible = (int)(m_ScrollPosition.y * scalar); + int maxVisible = minVisible + maxVisibleItems; - // Only adjust scroll if our selected items is not among visible items - if (scrollToItem < minVisible) - m_ScrollPosition.y = scrollToItem / scalar; - if (scrollToItem > maxVisible - kExtraMessageCount) - m_ScrollPosition.y = (scrollToItem - maxVisibleItems + kExtraMessageCount) / scalar; + // Only adjust scroll if our selected items is not among visible items + if (scrollToItem < minVisible) + m_ScrollPosition.y = scrollToItem / scalar; + if (scrollToItem > maxVisible - kExtraMessageCount) + m_ScrollPosition.y = (scrollToItem - maxVisibleItems + kExtraMessageCount) / scalar; - m_ScrollData.Reset(); - } - break; - case AutoScroll.ScrollToEnd: - m_ScrollPosition.y = totalWindowRect.height; - break; - case AutoScroll.Auto: - if (m_ScrollData.PerformScrollWhileInAuto) - m_ScrollPosition.y = totalWindowRect.height; - break; + m_ScrollToItem = -1; + } + } + else if (m_Runtime.UserSettings.AutoScroll) + { + m_ScrollPosition.y = totalWindowRect.height; } EditorGUI.BeginChangeCheck(); m_ScrollPosition = GUI.BeginScrollView(visibleWindowRect, m_ScrollPosition, totalWindowRect, true, false); var startItem = (int)(m_ScrollPosition.y * scalar); - // Check if we need to enable autoscrolling + // Scrolling manually turns auto scroll off, unless it ends at the last message var scrollChanged = EditorGUI.EndChangeCheck(); - if (m_Runtime.UserSettings.AutoScroll == AutoScroll.Auto) - { - if (scrollChanged || (e.type == EventType.ScrollWheel && e.delta.y > 0.0f)) - m_ScrollData.PerformScrollWhileInAuto = IsLastEntryVisible(m_ScrollPosition.y, visibleWindowRect.height, FilteredEntries.Count, AndroidLogcatStyles.kLogEntryFixedHeight); - else if (e.type == EventType.ScrollWheel && e.delta.y < 0.0f) - m_ScrollData.PerformScrollWhileInAuto = false; - } + if (scrollChanged || (e.type == EventType.ScrollWheel && e.delta.y > 0.0f)) + m_Runtime.UserSettings.AutoScroll = IsLastEntryVisible(m_ScrollPosition.y, visibleWindowRect.height, FilteredEntries.Count, AndroidLogcatStyles.kLogEntryFixedHeight); + else if (e.type == EventType.ScrollWheel && e.delta.y < 0.0f) + m_Runtime.UserSettings.AutoScroll = false; if (e.type == EventType.Repaint) { @@ -752,19 +723,18 @@ private void DoNavigation(int direction, bool shiftPressed) } m_Logcat.FilteredEntries[selectedItem].Selected = true; - m_Runtime.UserSettings.AutoScroll = AutoScroll.Disabled; - m_ScrollData.ScrollToItemWhileInDisabled = selectedItem; + m_Runtime.UserSettings.AutoScroll = false; + m_ScrollToItem = selectedItem; } private void DoScrollOptionsGUI() { - GUILayout.Label(kScroll, GUILayout.ExpandWidth(false)); - EditorGUI.BeginChangeCheck(); - var scroll = (AutoScroll)EditorGUILayout.EnumPopup(m_Runtime.UserSettings.AutoScroll, GUILayout.ExpandWidth(false)); - if (EditorGUI.EndChangeCheck()) + // Turning auto scroll on scrolls to the last message right away, see DoGUIEntries + var autoScroll = GUILayout.Toggle(m_Runtime.UserSettings.AutoScroll, AndroidLogcatStyles.kIconAutoScroll, EditorStyles.miniButton, GUILayout.Width(24), GUILayout.Height(18)); + if (autoScroll != m_Runtime.UserSettings.AutoScroll) { - m_ScrollData.Reset(); - m_Runtime.UserSettings.AutoScroll = scroll; + m_ScrollToItem = -1; + m_Runtime.UserSettings.AutoScroll = autoScroll; } } diff --git a/com.unity.mobile.android-logcat/Editor/AndroidLogcatStyles.cs b/com.unity.mobile.android-logcat/Editor/AndroidLogcatStyles.cs index d059fac4..cc3486b8 100644 --- a/com.unity.mobile.android-logcat/Editor/AndroidLogcatStyles.cs +++ b/com.unity.mobile.android-logcat/Editor/AndroidLogcatStyles.cs @@ -154,6 +154,7 @@ public static Texture2D LoadIcon(string name) internal static readonly GUIContent kIconToolbarDown = new GUIContent(LoadIcon("DownArrow")); internal static readonly GUIContent kIconToolbarUp = new GUIContent(LoadIcon("UpArrow")); internal static readonly GUIContent kIconReset = new GUIContent(LoadIcon("Reset"), "Reset"); + internal static readonly GUIContent kIconAutoScroll = new GUIContent(LoadIcon("DownArrowToLine"), "Auto Scroll: scroll to the last message and follow new ones. Turns off when you scroll up, and back on when you scroll to the last message."); internal static readonly GUIContent[] kIconPlay = new[] { new GUIContent(LoadIcon("PlayOn")), new GUIContent(LoadIcon("PlayOff")) diff --git a/com.unity.mobile.android-logcat/Editor/AndroidLogcatUserSettings.cs b/com.unity.mobile.android-logcat/Editor/AndroidLogcatUserSettings.cs index 4c31f870..18bccdbb 100644 --- a/com.unity.mobile.android-logcat/Editor/AndroidLogcatUserSettings.cs +++ b/com.unity.mobile.android-logcat/Editor/AndroidLogcatUserSettings.cs @@ -102,8 +102,9 @@ internal class CommandsSettingsData [SerializeField] private CommandsSettingsData m_CommandsSettings; + // Not m_AutoScroll, which held the former Disabled/ScrollToEnd/Auto enum, so older saved settings aren't misread as a bool [SerializeField] - private AutoScroll m_AutoScroll; + private bool m_AutoScrollEnabled; public string LastSelectedDeviceId { @@ -164,7 +165,7 @@ public Priority SelectedPriority public InputSettings DeviceInputSettings { set => m_InputSettings = value; get => m_InputSettings; } public CommandsSettingsData CommandsSettings { set => m_CommandsSettings = value; get => m_CommandsSettings; } - public AutoScroll AutoScroll { set => m_AutoScroll = value; get => m_AutoScroll; } + public bool AutoScroll { set => m_AutoScrollEnabled = value; get => m_AutoScrollEnabled; } private void RefreshProcessesForSerialization() { @@ -333,7 +334,7 @@ internal void Reset() m_MemoryViewerState = new AndroidLogcatMemoryViewerState(); m_SymbolPaths = new List(); m_FilterOptions = new FilterOptions(); - m_AutoScroll = AutoScroll.Auto; + m_AutoScrollEnabled = true; ResetScreenCaptureSettings(); diff --git a/com.unity.mobile.android-logcat/Editor/Textures/DownArrowToLine.png b/com.unity.mobile.android-logcat/Editor/Textures/DownArrowToLine.png new file mode 100644 index 0000000000000000000000000000000000000000..0dc45e0a777e8c83863fd17931a892dff2065a92 GIT binary patch literal 918 zcmV;H18Mw;P)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D11m{HK~zXft(9AA z6HySyN1p`=t-YOD0kjX=S4Ce7`mSQ}T2WgspFjmc5No_( zREp9@nl!N~*cNP))ZJ!``TnaH3i@rN~;zafM z@ng!-BS)q?J3G}%rDABBX4LMHV^p1~n$wkvarVraZ|&{vm5z>%>C>lADY7iT2LORB z%;Ii|#h#6ik0W6i1{%6fU66@mz(}X3&@@fw{KUir?n@@006-&Kcq#ZuB>XCu%i^4E z>vawp^1sep!w_r_SihP&cEM;zB-8Ce%rQ zOp64#{Jb#7bxNe^3ukpO+ zDv9H`F1Oo#&dYIKJkMYD`S`1}dcFJwua~%NHybi#R$uilfCM7Dq;$ z*b(h(8eudxHimE0Y24h@be^rf2pXLb2y}0hq#jWe?@JO%x+RL@J!#>Z)FVk!uOvx# sYWv%QAoPl&aCd_!-V*|W8%vGu2dzny4%ttJ%m4rY07*qoM6N<$f+XpzkN^Mx literal 0 HcmV?d00001 diff --git a/com.unity.mobile.android-logcat/Editor/Textures/DownArrowToLine.png.meta b/com.unity.mobile.android-logcat/Editor/Textures/DownArrowToLine.png.meta new file mode 100644 index 00000000..a59531c7 --- /dev/null +++ b/com.unity.mobile.android-logcat/Editor/Textures/DownArrowToLine.png.meta @@ -0,0 +1,130 @@ +fileFormatVersion: 2 +guid: fa62b24064aead64bb9c045bdd41a8e7 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 1 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 5 + maxTextureSize: 1024 + textureSettings: + serializedVersion: 2 + filterMode: 0 + aniso: 1 + mipBias: 0 + wrapU: 1 + wrapV: 1 + wrapW: 1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 1 + swizzle: 50462976 + cookieLightType: 1 + platformSettings: + - serializedVersion: 4 + buildTarget: DefaultTexturePlatform + maxTextureSize: 1024 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Standalone + maxTextureSize: 1024 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 4 + buildTarget: Android + maxTextureSize: 1024 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 0 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + customData: + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spriteCustomMetadata: + entries: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: From 041fc52a26e77fef6fe49e87c1257a95ade7dfa4 Mon Sep 17 00:00:00 2001 From: Tomas Date: Fri, 20 Nov 2026 17:07:30 +0200 Subject: [PATCH 2/4] Move Auto Scroll toggle to the corner between the scrollbars The vertical scrollbar is always shown so the corner is always there, and both scrollbars are slightly thicker to give the toggle more room. The icon is redrawn as a flat arrow like the scrollbar's own, tinted for the current skin. Co-Authored-By: Claude Opus 5.5 --- com.unity.mobile.android-logcat/CHANGELOG.md | 2 +- .../Editor/AndroidLogcatConsoleWindow.cs | 3 -- .../Editor/AndroidLogcatMessagesViews.cs | 31 +++++++++++++----- .../Editor/AndroidLogcatStyles.cs | 14 ++++++++ .../Editor/Textures/DownArrowToLine.png | Bin 918 -> 279 bytes .../Editor/Textures/DownArrowToLine.png.meta | 2 +- 6 files changed, 39 insertions(+), 13 deletions(-) diff --git a/com.unity.mobile.android-logcat/CHANGELOG.md b/com.unity.mobile.android-logcat/CHANGELOG.md index 425b7db4..6e88d9ee 100644 --- a/com.unity.mobile.android-logcat/CHANGELOG.md +++ b/com.unity.mobile.android-logcat/CHANGELOG.md @@ -6,7 +6,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] ### Fixes & Improvements - - Replaced the Scroll dropdown (Disabled / Scroll To End / Auto) below the message log with an Auto Scroll toggle button. Turning it on scrolls to the last message and keeps following new ones. Scrolling up or selecting messages with the Up and Down keys turns it off, and scrolling back to the last message turns it back on. + - Replaced the Scroll dropdown (Disabled / Scroll To End / Auto) below the message log with an Auto Scroll toggle button in the corner between the message log's scrollbars. Turning it on scrolls to the last message and keeps following new ones. Scrolling up or selecting messages with the Up and Down keys turns it off, and scrolling back to the last message turns it back on. ## [1.5.0] - 2026-11-18 ### Fixes & Improvements diff --git a/com.unity.mobile.android-logcat/Editor/AndroidLogcatConsoleWindow.cs b/com.unity.mobile.android-logcat/Editor/AndroidLogcatConsoleWindow.cs index 418ea247..1d073a5c 100644 --- a/com.unity.mobile.android-logcat/Editor/AndroidLogcatConsoleWindow.cs +++ b/com.unity.mobile.android-logcat/Editor/AndroidLogcatConsoleWindow.cs @@ -444,11 +444,8 @@ internal void OnGUI() break; } - EditorGUILayout.BeginHorizontal(); if (m_StatusBar != null) m_StatusBar.DoGUI(); - DoScrollOptionsGUI(); - EditorGUILayout.EndHorizontal(); EditorGUILayout.EndVertical(); } diff --git a/com.unity.mobile.android-logcat/Editor/AndroidLogcatMessagesViews.cs b/com.unity.mobile.android-logcat/Editor/AndroidLogcatMessagesViews.cs index 5c74c94a..bd1028c6 100644 --- a/com.unity.mobile.android-logcat/Editor/AndroidLogcatMessagesViews.cs +++ b/com.unity.mobile.android-logcat/Editor/AndroidLogcatMessagesViews.cs @@ -19,7 +19,7 @@ internal partial class AndroidLogcatConsoleWindow /// Whether the last log entry is visible for the given scroll position. /// Compared in pixels, since comparing rounded item counts fails at certain window heights, /// when the fractional part of visible rows is bigger than the horizontal scrollbar height. - /// Note: visibleHeight includes horizontal scrollbar, so the entry might be partially hidden behind the scrollbar. + /// Note: if visibleHeight includes the horizontal scrollbar, the entry might be hidden behind the scrollbar. /// internal static bool IsLastEntryVisible(float scrollY, float visibleHeight, int entryCount, int rowHeight) { @@ -380,6 +380,9 @@ private bool DoGUIEntries() totalWindowRect.height = AndroidLogcatStyles.kLogEntryFixedHeight * (FilteredEntries.Count + kExtraMessageCount); totalWindowRect.width = Mathf.Max(totalWindowRect.width, m_MaxLogEntryWidth); + // Before the scroll view, so turning auto scroll on scrolls to the end in this same event + DoAutoScrollToggle(visibleWindowRect); + var controlId = GUIUtility.GetControlID(FocusType.Keyboard); var scalar = (float)(kExtraMessageCount + FilteredEntries.Count) / totalWindowRect.height; @@ -408,13 +411,16 @@ private bool DoGUIEntries() } EditorGUI.BeginChangeCheck(); - m_ScrollPosition = GUI.BeginScrollView(visibleWindowRect, m_ScrollPosition, totalWindowRect, true, false); + // Vertical scrollbar is always shown, so the auto scroll toggle always has the corner between the scrollbars + var horizontalBar = AndroidLogcatStyles.messagesHorizontalScrollbar; + m_ScrollPosition = GUI.BeginScrollView(visibleWindowRect, m_ScrollPosition, totalWindowRect, true, true, horizontalBar, AndroidLogcatStyles.messagesVerticalScrollbar); + var horizontalBarHeight = horizontalBar.fixedHeight + horizontalBar.margin.top; var startItem = (int)(m_ScrollPosition.y * scalar); // Scrolling manually turns auto scroll off, unless it ends at the last message var scrollChanged = EditorGUI.EndChangeCheck(); if (scrollChanged || (e.type == EventType.ScrollWheel && e.delta.y > 0.0f)) - m_Runtime.UserSettings.AutoScroll = IsLastEntryVisible(m_ScrollPosition.y, visibleWindowRect.height, FilteredEntries.Count, AndroidLogcatStyles.kLogEntryFixedHeight); + m_Runtime.UserSettings.AutoScroll = IsLastEntryVisible(m_ScrollPosition.y, visibleWindowRect.height - horizontalBarHeight, FilteredEntries.Count, AndroidLogcatStyles.kLogEntryFixedHeight); else if (e.type == EventType.ScrollWheel && e.delta.y < 0.0f) m_Runtime.UserSettings.AutoScroll = false; @@ -466,8 +472,7 @@ private bool DoGUIEntries() GUI.EndScrollView(); Rect rc = GUILayoutUtility.GetLastRect(); - // Decrement horizontal scrollbar height - rc.height -= 15.0f; + rc.height -= horizontalBarHeight; DoColumnBorders(rc, Color.black, 1); return requestRepaint; @@ -727,10 +732,20 @@ private void DoNavigation(int direction, bool shiftPressed) m_ScrollToItem = selectedItem; } - private void DoScrollOptionsGUI() + private void DoAutoScrollToggle(Rect scrollViewRect) { - // Turning auto scroll on scrolls to the last message right away, see DoGUIEntries - var autoScroll = GUILayout.Toggle(m_Runtime.UserSettings.AutoScroll, AndroidLogcatStyles.kIconAutoScroll, EditorStyles.miniButton, GUILayout.Width(24), GUILayout.Height(18)); + var horizontalBar = AndroidLogcatStyles.messagesHorizontalScrollbar; + var verticalBar = AndroidLogcatStyles.messagesVerticalScrollbar; + var corner = Rect.MinMaxRect( + scrollViewRect.xMax - verticalBar.fixedWidth - verticalBar.margin.left, + scrollViewRect.yMax - horizontalBar.fixedHeight - horizontalBar.margin.top, + scrollViewRect.xMax, + scrollViewRect.yMax); + // The icon is white, tinted like the scrollbar arrows of the current skin + var orgContentColor = GUI.contentColor; + GUI.contentColor = EditorGUIUtility.isProSkin ? new Color(0.77f, 0.77f, 0.77f) : new Color(0.33f, 0.33f, 0.33f); + var autoScroll = GUI.Toggle(corner, m_Runtime.UserSettings.AutoScroll, AndroidLogcatStyles.kIconAutoScroll, AndroidLogcatStyles.scrollCornerToggle); + GUI.contentColor = orgContentColor; if (autoScroll != m_Runtime.UserSettings.AutoScroll) { m_ScrollToItem = -1; diff --git a/com.unity.mobile.android-logcat/Editor/AndroidLogcatStyles.cs b/com.unity.mobile.android-logcat/Editor/AndroidLogcatStyles.cs index cc3486b8..6dfbc5f5 100644 --- a/com.unity.mobile.android-logcat/Editor/AndroidLogcatStyles.cs +++ b/com.unity.mobile.android-logcat/Editor/AndroidLogcatStyles.cs @@ -20,6 +20,20 @@ static class AndroidLogcatStyles public static readonly GUIStyle toolbarLabelLeft = new GUIStyle("toolbarButton") { fontSize = kFontSize, fixedHeight = kFixedHeight, alignment = TextAnchor.MiddleLeft }; public static readonly GUIStyle columnHeader = new GUIStyle("OL TITLE"); + public static readonly GUIStyle scrollCornerToggle = new GUIStyle("toolbarButton") { padding = new RectOffset(), margin = new RectOffset(), fixedWidth = 0, fixedHeight = 0 }; + // Thicker than default, so the auto scroll toggle in the corner between them is bigger + public static readonly GUIStyle messagesHorizontalScrollbar = ScaleScrollbar("horizontalscrollbar"); + public static readonly GUIStyle messagesVerticalScrollbar = ScaleScrollbar("verticalscrollbar"); + + static GUIStyle ScaleScrollbar(string name) + { + const float kScale = 1.1f; + // Keeps the name, which the scrollbar uses to find its thumb and button styles + var style = new GUIStyle(name); + style.fixedWidth *= kScale; + style.fixedHeight *= kScale; + return style; + } public static int kLogEntryFontSize = 11; public static int kLogEntryFixedHeight = kLogEntryFontSize + 5; diff --git a/com.unity.mobile.android-logcat/Editor/Textures/DownArrowToLine.png b/com.unity.mobile.android-logcat/Editor/Textures/DownArrowToLine.png index 0dc45e0a777e8c83863fd17931a892dff2065a92..a0688962be8b69c228323c50f13de8de47dfd0af 100644 GIT binary patch delta 237 zcmVdZ`EYw`A&ePF9I9Sy#-jmjPCrt7fIXr nL;Za4WBJF_-!NROhri(g=Hf6p4V?tP00000NkvXXu0mjfMEhWa delta 881 zcmV-%1CIQc0+t6MiBL{Q4GJ0x0000DNk~Le0000Q0000L2nGNE09YLU8<8P2e*-H? zL_t(YORbe#YZFlr$48$939Z5G=C->UD?X^j%ae&@)1-}x`T?{L+E+zi3;M2N@mf(^ zFP}gKK@e-aU{s3IMw&FSDcBZllhoa2h3>5*vrURU7B96w_;b!IXXek$-T?kULqkK- z7x3K-`u#n@puaa54BiriAg#TAf4{${v9a+mo3kt;kv$Lk`};AI$>6}i01nnf@y8Dz zFcJwr1%Op--anH}wmqCtRkSS2&~@D;&Cbr6gjTI$A|8JU0IS)&f2OT1@vu~yLQT_5 zRaGt0jH;U7HO(xS%NUQh^szb1B9TZuE|p41h3h7&qFNMJ%4KYAZCx>=e@9c3lM6j7YEP1~EBxA#p>eqG#=s+u&)a;bznckW07z%~Hb0sxxf1Ztxk0W6i1{%6fU66@mz(}X3&@@fw{KUir?n@@006-&K zcq#ZuB>XCu%i^4E>vaf3{qcI(}J>KBvy; z%TPC?mEuA^PbSn!fK6NuzGyW1GM~?*WtzJ3O))IfGCmhRV@oXd4ge%J;eXg5%kmrQ zY;JCDwooY4O*XOzR|4t4{{3%Xyh!1pg9piE6MJAK@vL3D=G6b*cyPH~yFDJyb)M%g z@jQQp Date: Fri, 20 Nov 2026 17:09:51 +0200 Subject: [PATCH 3/4] Fade Auto Scroll icon while off, smaller arrow, normal scrollbar width Co-Authored-By: Claude Opus 5.5 --- .../Editor/AndroidLogcatMessagesViews.cs | 7 +++++-- .../Editor/AndroidLogcatStyles.cs | 2 +- .../Editor/Textures/DownArrowToLine.png | Bin 279 -> 238 bytes 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/com.unity.mobile.android-logcat/Editor/AndroidLogcatMessagesViews.cs b/com.unity.mobile.android-logcat/Editor/AndroidLogcatMessagesViews.cs index bd1028c6..87124077 100644 --- a/com.unity.mobile.android-logcat/Editor/AndroidLogcatMessagesViews.cs +++ b/com.unity.mobile.android-logcat/Editor/AndroidLogcatMessagesViews.cs @@ -741,9 +741,12 @@ private void DoAutoScrollToggle(Rect scrollViewRect) scrollViewRect.yMax - horizontalBar.fixedHeight - horizontalBar.margin.top, scrollViewRect.xMax, scrollViewRect.yMax); - // The icon is white, tinted like the scrollbar arrows of the current skin + // The icon is white, tinted like the scrollbar arrows of the current skin, and faded while off var orgContentColor = GUI.contentColor; - GUI.contentColor = EditorGUIUtility.isProSkin ? new Color(0.77f, 0.77f, 0.77f) : new Color(0.33f, 0.33f, 0.33f); + var iconColor = EditorGUIUtility.isProSkin ? new Color(0.77f, 0.77f, 0.77f) : new Color(0.33f, 0.33f, 0.33f); + if (!m_Runtime.UserSettings.AutoScroll) + iconColor.a = 0.35f; + GUI.contentColor = iconColor; var autoScroll = GUI.Toggle(corner, m_Runtime.UserSettings.AutoScroll, AndroidLogcatStyles.kIconAutoScroll, AndroidLogcatStyles.scrollCornerToggle); GUI.contentColor = orgContentColor; if (autoScroll != m_Runtime.UserSettings.AutoScroll) diff --git a/com.unity.mobile.android-logcat/Editor/AndroidLogcatStyles.cs b/com.unity.mobile.android-logcat/Editor/AndroidLogcatStyles.cs index 6dfbc5f5..f52e53de 100644 --- a/com.unity.mobile.android-logcat/Editor/AndroidLogcatStyles.cs +++ b/com.unity.mobile.android-logcat/Editor/AndroidLogcatStyles.cs @@ -27,7 +27,7 @@ static class AndroidLogcatStyles static GUIStyle ScaleScrollbar(string name) { - const float kScale = 1.1f; + const float kScale = 1.0f; // Keeps the name, which the scrollbar uses to find its thumb and button styles var style = new GUIStyle(name); style.fixedWidth *= kScale; diff --git a/com.unity.mobile.android-logcat/Editor/Textures/DownArrowToLine.png b/com.unity.mobile.android-logcat/Editor/Textures/DownArrowToLine.png index a0688962be8b69c228323c50f13de8de47dfd0af..a6c10df3b89eb68883455a1239b68ddec659793b 100644 GIT binary patch delta 160 zcmV;R0AK%?0`38jR)2#@L_t(YOYPCI4S+BZLs3dfMqmUsW(>w)1V&&32U)sA!XT7O z08#MU_+FEy`Fk}0V<-&3q~5L)oM;H4RqK!qvjQ+@p^U>E+|W+%FEgBnrvX^pXpDzv zxS_r7T^UX&qH8r8BShTLLEoz)emnZz_J8kBy_62Ush85BHyQQ*o^1m;0R`n4iK=t} O0000b0ha=hR)4HXL_t(YOYPGk4#GebgyBjg5{X1|432dZ`EYw`A&eP zF9I9Sy#-jmjPCrt7fIXrL;Za4WBJF_-!NROhri(g=Hf6p4V?tP00000NkvXXu0mjf D*U?*j From b141790a90f99058a55e8f567cd77349ddeeaad9 Mon Sep 17 00:00:00 2001 From: Tomas Date: Fri, 20 Nov 2026 17:11:19 +0200 Subject: [PATCH 4/4] Use the default scrollbar styles for the message log Co-Authored-By: Claude Opus 5.5 --- .../Editor/AndroidLogcatMessagesViews.cs | 8 ++++---- .../Editor/AndroidLogcatStyles.cs | 13 ------------- 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/com.unity.mobile.android-logcat/Editor/AndroidLogcatMessagesViews.cs b/com.unity.mobile.android-logcat/Editor/AndroidLogcatMessagesViews.cs index 87124077..8051a5c6 100644 --- a/com.unity.mobile.android-logcat/Editor/AndroidLogcatMessagesViews.cs +++ b/com.unity.mobile.android-logcat/Editor/AndroidLogcatMessagesViews.cs @@ -412,8 +412,8 @@ private bool DoGUIEntries() EditorGUI.BeginChangeCheck(); // Vertical scrollbar is always shown, so the auto scroll toggle always has the corner between the scrollbars - var horizontalBar = AndroidLogcatStyles.messagesHorizontalScrollbar; - m_ScrollPosition = GUI.BeginScrollView(visibleWindowRect, m_ScrollPosition, totalWindowRect, true, true, horizontalBar, AndroidLogcatStyles.messagesVerticalScrollbar); + m_ScrollPosition = GUI.BeginScrollView(visibleWindowRect, m_ScrollPosition, totalWindowRect, true, true); + var horizontalBar = GUI.skin.horizontalScrollbar; var horizontalBarHeight = horizontalBar.fixedHeight + horizontalBar.margin.top; var startItem = (int)(m_ScrollPosition.y * scalar); @@ -734,8 +734,8 @@ private void DoNavigation(int direction, bool shiftPressed) private void DoAutoScrollToggle(Rect scrollViewRect) { - var horizontalBar = AndroidLogcatStyles.messagesHorizontalScrollbar; - var verticalBar = AndroidLogcatStyles.messagesVerticalScrollbar; + var horizontalBar = GUI.skin.horizontalScrollbar; + var verticalBar = GUI.skin.verticalScrollbar; var corner = Rect.MinMaxRect( scrollViewRect.xMax - verticalBar.fixedWidth - verticalBar.margin.left, scrollViewRect.yMax - horizontalBar.fixedHeight - horizontalBar.margin.top, diff --git a/com.unity.mobile.android-logcat/Editor/AndroidLogcatStyles.cs b/com.unity.mobile.android-logcat/Editor/AndroidLogcatStyles.cs index f52e53de..4078dae0 100644 --- a/com.unity.mobile.android-logcat/Editor/AndroidLogcatStyles.cs +++ b/com.unity.mobile.android-logcat/Editor/AndroidLogcatStyles.cs @@ -21,19 +21,6 @@ static class AndroidLogcatStyles public static readonly GUIStyle columnHeader = new GUIStyle("OL TITLE"); public static readonly GUIStyle scrollCornerToggle = new GUIStyle("toolbarButton") { padding = new RectOffset(), margin = new RectOffset(), fixedWidth = 0, fixedHeight = 0 }; - // Thicker than default, so the auto scroll toggle in the corner between them is bigger - public static readonly GUIStyle messagesHorizontalScrollbar = ScaleScrollbar("horizontalscrollbar"); - public static readonly GUIStyle messagesVerticalScrollbar = ScaleScrollbar("verticalscrollbar"); - - static GUIStyle ScaleScrollbar(string name) - { - const float kScale = 1.0f; - // Keeps the name, which the scrollbar uses to find its thumb and button styles - var style = new GUIStyle(name); - style.fixedWidth *= kScale; - style.fixedHeight *= kScale; - return style; - } public static int kLogEntryFontSize = 11; public static int kLogEntryFixedHeight = kLogEntryFontSize + 5;