Skip to content

Commit afe348b

Browse files
committed
Fixed occasional warning spam on Unity 2022 (fixed #77)
1 parent 19f051c commit afe348b

File tree

5 files changed

+70
-2
lines changed

5 files changed

+70
-2
lines changed

Plugins/IngameDebugConsole/IngameDebugConsole.prefab

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1274,13 +1274,16 @@ MonoBehaviour:
12741274
receiveExceptionLogs: 1
12751275
captureLogTimestamps: 0
12761276
alwaysDisplayTimestamps: 0
1277+
maxLogCount: 2147483647
1278+
logsToRemoveAfterMaxLogCount: 16
12771279
queuedLogLimit: 256
12781280
clearCommandAfterExecution: 1
12791281
commandHistorySize: 15
12801282
showCommandSuggestions: 1
12811283
receiveLogcatLogsInAndroid: 0
12821284
logcatArguments:
12831285
avoidScreenCutout: 1
1286+
popupAvoidsScreenCutout: 0
12841287
maxLogLength: 10000
12851288
autoFocusOnCommandInputField: 1
12861289
logItemPrefab: {fileID: 11408050, guid: 391be5df5ef62f345bb76a1051c04da7, type: 2}
@@ -2593,6 +2596,7 @@ GameObject:
25932596
serializedVersion: 5
25942597
m_Component:
25952598
- component: {fileID: 224000011255372986}
2599+
- component: {fileID: 114913451135716890}
25962600
- component: {fileID: 222000010912077860}
25972601
- component: {fileID: 114000013324539428}
25982602
- component: {fileID: 114000010993257018}
@@ -2680,6 +2684,7 @@ GameObject:
26802684
serializedVersion: 5
26812685
m_Component:
26822686
- component: {fileID: 224927884203097686}
2687+
- component: {fileID: 114705835229318780}
26832688
- component: {fileID: 222677458225366564}
26842689
- component: {fileID: 114677982133495580}
26852690
- component: {fileID: 114664465529608634}
@@ -3466,6 +3471,17 @@ MonoBehaviour:
34663471
m_FillAmount: 1
34673472
m_FillClockwise: 1
34683473
m_FillOrigin: 0
3474+
--- !u!114 &114705835229318780
3475+
MonoBehaviour:
3476+
m_ObjectHideFlags: 1
3477+
m_PrefabParentObject: {fileID: 0}
3478+
m_PrefabInternal: {fileID: 100100000}
3479+
m_GameObject: {fileID: 1197649202466618}
3480+
m_Enabled: 1
3481+
m_EditorHideFlags: 0
3482+
m_Script: {fileID: 11500000, guid: 049982f63fd78c042851caecd952f3f4, type: 3}
3483+
m_Name:
3484+
m_EditorClassIdentifier:
34693485
--- !u!114 &114749866180229960
34703486
MonoBehaviour:
34713487
m_ObjectHideFlags: 1
@@ -3578,6 +3594,17 @@ MonoBehaviour:
35783594
m_FillAmount: 1
35793595
m_FillClockwise: 1
35803596
m_FillOrigin: 0
3597+
--- !u!114 &114913451135716890
3598+
MonoBehaviour:
3599+
m_ObjectHideFlags: 1
3600+
m_PrefabParentObject: {fileID: 0}
3601+
m_PrefabInternal: {fileID: 100100000}
3602+
m_GameObject: {fileID: 1000013131456698}
3603+
m_Enabled: 1
3604+
m_EditorHideFlags: 0
3605+
m_Script: {fileID: 11500000, guid: 049982f63fd78c042851caecd952f3f4, type: 3}
3606+
m_Name:
3607+
m_EditorClassIdentifier:
35813608
--- !u!114 &114944715489184838
35823609
MonoBehaviour:
35833610
m_ObjectHideFlags: 1

Plugins/IngameDebugConsole/README.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
= In-game Debug Console (v1.6.4) =
1+
= In-game Debug Console (v1.6.6) =
22

33
Documentation: https://github.com/yasirkula/UnityIngameDebugConsole
44
FAQ: https://github.com/yasirkula/UnityIngameDebugConsole#faq
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
using System.Reflection;
2+
using UnityEngine;
3+
using UnityEngine.UI;
4+
5+
namespace IngameDebugConsole
6+
{
7+
// Fixes: https://github.com/yasirkula/UnityIngameDebugConsole/issues/77
8+
// This was caused by Canvas.ForceUpdateCanvases in InputField.UpdateLabel (added in 2022.1 to resolve another bug: https://issuetracker.unity3d.com/issues/input-fields-width-doesnt-change-after-entering-specific-combinations-of-text-when-the-content-size-fitter-is-used)
9+
// which is triggered from InputField.OnValidate. UpdateLabel isn't invoked if a variable called m_PreventFontCallback is true,
10+
// which is what this component is doing: temporarily switching that variable before InputField.OnValidate to avoid this issue.
11+
#if UNITY_2022_1_OR_NEWER && UNITY_EDITOR
12+
[DefaultExecutionOrder( -50 )]
13+
#endif
14+
public class InputFieldWarningsFixer : MonoBehaviour
15+
{
16+
#if UNITY_2022_1_OR_NEWER && UNITY_EDITOR
17+
private static readonly FieldInfo preventFontCallback = typeof( InputField ).GetField( "m_PreventFontCallback", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance );
18+
19+
protected void OnValidate()
20+
{
21+
if( preventFontCallback != null && TryGetComponent( out InputField inputField ) )
22+
{
23+
preventFontCallback.SetValue( inputField, true );
24+
UnityEditor.EditorApplication.delayCall += () => preventFontCallback.SetValue( inputField, false );
25+
}
26+
}
27+
#endif
28+
}
29+
}

Plugins/IngameDebugConsole/Scripts/InputFieldWarningsFixer.cs.meta

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "com.yasirkula.ingamedebugconsole",
33
"displayName": "In-game Debug Console",
4-
"version": "1.6.4",
4+
"version": "1.6.6",
55
"documentationUrl": "https://github.com/yasirkula/UnityIngameDebugConsole",
66
"changelogUrl": "https://github.com/yasirkula/UnityIngameDebugConsole/releases",
77
"licensesUrl": "https://github.com/yasirkula/UnityIngameDebugConsole/blob/master/LICENSE.txt",

0 commit comments

Comments
 (0)