diff --git a/com.unity.mobile.android-logcat/CHANGELOG.md b/com.unity.mobile.android-logcat/CHANGELOG.md
index 6d760ea1..6e88d9ee 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 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
- 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..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();
}
@@ -478,8 +475,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..8051a5c6 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;
@@ -37,7 +19,7 @@ public void Reset()
/// 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)
{
@@ -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()
@@ -398,54 +380,49 @@ 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;
- 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);
+ // Vertical scrollbar is always shown, so the auto scroll toggle always has the corner between the scrollbars
+ 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);
- // 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 - horizontalBarHeight, 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)
{
@@ -495,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;
@@ -752,19 +728,31 @@ 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()
+ private void DoAutoScrollToggle(Rect scrollViewRect)
{
- GUILayout.Label(kScroll, GUILayout.ExpandWidth(false));
- EditorGUI.BeginChangeCheck();
- var scroll = (AutoScroll)EditorGUILayout.EnumPopup(m_Runtime.UserSettings.AutoScroll, GUILayout.ExpandWidth(false));
- if (EditorGUI.EndChangeCheck())
- {
- m_ScrollData.Reset();
- m_Runtime.UserSettings.AutoScroll = scroll;
+ 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,
+ scrollViewRect.xMax,
+ scrollViewRect.yMax);
+ // The icon is white, tinted like the scrollbar arrows of the current skin, and faded while off
+ var orgContentColor = GUI.contentColor;
+ 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)
+ {
+ 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..4078dae0 100644
--- a/com.unity.mobile.android-logcat/Editor/AndroidLogcatStyles.cs
+++ b/com.unity.mobile.android-logcat/Editor/AndroidLogcatStyles.cs
@@ -20,6 +20,7 @@ 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 };
public static int kLogEntryFontSize = 11;
public static int kLogEntryFixedHeight = kLogEntryFontSize + 5;
@@ -154,6 +155,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 00000000..a6c10df3
Binary files /dev/null and b/com.unity.mobile.android-logcat/Editor/Textures/DownArrowToLine.png differ
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..bd4834ee
--- /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: 1
+ 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: