Skip to content

Commit 4f2e4c8

Browse files
committed
Updated Unity version to 2021.3.41f1 (simplified codebase accordingly)
1 parent 1d3905c commit 4f2e4c8

27 files changed

Lines changed: 1306 additions & 392 deletions

Plugins/IngameDebugConsole/Editor/DebugLogManagerEditor.cs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,7 @@ public class DebugLogManagerEditor : Editor
3939
private SerializedProperty popupAvoidsScreenCutout;
4040
private SerializedProperty autoFocusOnCommandInputField;
4141

42-
#if UNITY_2017_3_OR_NEWER
4342
private readonly GUIContent popupVisibilityLogFilterLabel = new GUIContent( "Log Filter", "Determines which log types will show the popup on screen" );
44-
#endif
4543
private readonly GUIContent receivedLogTypesLabel = new GUIContent( "Received Log Types", "Only these logs will be received by the console window, other logs will simply be skipped" );
4644
private readonly GUIContent receiveInfoLogsLabel = new GUIContent( "Info" );
4745
private readonly GUIContent receiveWarningLogsLabel = new GUIContent( "Warning" );
@@ -118,21 +116,9 @@ public override void OnInspectorGUI()
118116
if( popupVisibility.intValue == (int) PopupVisibility.WhenLogReceived )
119117
{
120118
EditorGUI.indentLevel++;
121-
#if UNITY_2017_3_OR_NEWER
122119
Rect rect = EditorGUILayout.GetControlRect();
123120
EditorGUI.BeginProperty( rect, GUIContent.none, popupVisibilityLogFilter );
124121
popupVisibilityLogFilter.intValue = (int) (DebugLogFilter) EditorGUI.EnumFlagsField( rect, popupVisibilityLogFilterLabel, (DebugLogFilter) popupVisibilityLogFilter.intValue );
125-
#else
126-
EditorGUI.BeginProperty( new Rect(), GUIContent.none, popupVisibilityLogFilter );
127-
EditorGUI.BeginChangeCheck();
128-
129-
bool infoLog = EditorGUILayout.Toggle( "Info", ( (DebugLogFilter) popupVisibilityLogFilter.intValue & DebugLogFilter.Info ) == DebugLogFilter.Info );
130-
bool warningLog = EditorGUILayout.Toggle( "Warning", ( (DebugLogFilter) popupVisibilityLogFilter.intValue & DebugLogFilter.Warning ) == DebugLogFilter.Warning );
131-
bool errorLog = EditorGUILayout.Toggle( "Error", ( (DebugLogFilter) popupVisibilityLogFilter.intValue & DebugLogFilter.Error ) == DebugLogFilter.Error );
132-
133-
if( EditorGUI.EndChangeCheck() )
134-
popupVisibilityLogFilter.intValue = ( infoLog ? (int) DebugLogFilter.Info : 0 ) | ( warningLog ? (int) DebugLogFilter.Warning : 0 ) | ( errorLog ? (int) DebugLogFilter.Error : 0 );
135-
#endif
136122
EditorGUI.EndProperty();
137123
EditorGUI.indentLevel--;
138124
}

Plugins/IngameDebugConsole/Scripts/DebugLogConsole.cs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,10 @@ public static class DebugLogConsole
8888
{ typeof( RectOffset ), ParseRectOffset },
8989
{ typeof( Bounds ), ParseBounds },
9090
{ typeof( GameObject ), ParseGameObject },
91-
#if UNITY_2017_2_OR_NEWER
9291
{ typeof( Vector2Int ), ParseVector2Int },
9392
{ typeof( Vector3Int ), ParseVector3Int },
9493
{ typeof( RectInt ), ParseRectInt },
9594
{ typeof( BoundsInt ), ParseBoundsInt },
96-
#endif
9795
};
9896

9997
// All the readable names of accepted types
@@ -304,24 +302,16 @@ public static void LogSystemInfo()
304302
stringBuilder.Append( "Temporary Cache Path: " ).Append( Application.temporaryCachePath ).Append( "\n" );
305303
stringBuilder.Append( "Device ID: " ).Append( SystemInfo.deviceUniqueIdentifier ).Append( "\n" );
306304
stringBuilder.Append( "Max Texture Size: " ).Append( SystemInfo.maxTextureSize ).Append( "\n" );
307-
#if UNITY_5_6_OR_NEWER
308305
stringBuilder.Append( "Max Cubemap Size: " ).Append( SystemInfo.maxCubemapSize ).Append( "\n" );
309-
#endif
310306
stringBuilder.Append( "Accelerometer: " ).Append( SystemInfo.supportsAccelerometer ? "supported\n" : "not supported\n" );
311307
stringBuilder.Append( "Gyro: " ).Append( SystemInfo.supportsGyroscope ? "supported\n" : "not supported\n" );
312308
stringBuilder.Append( "Location Service: " ).Append( SystemInfo.supportsLocationService ? "supported\n" : "not supported\n" );
313-
#if !UNITY_2019_1_OR_NEWER
314-
stringBuilder.Append( "Image Effects: " ).Append( SystemInfo.supportsImageEffects ? "supported\n" : "not supported\n" );
315-
stringBuilder.Append( "RenderToCubemap: " ).Append( SystemInfo.supportsRenderToCubemap ? "supported\n" : "not supported\n" );
316-
#endif
317309
stringBuilder.Append( "Compute Shaders: " ).Append( SystemInfo.supportsComputeShaders ? "supported\n" : "not supported\n" );
318310
stringBuilder.Append( "Shadows: " ).Append( SystemInfo.supportsShadows ? "supported\n" : "not supported\n" );
319311
stringBuilder.Append( "Instancing: " ).Append( SystemInfo.supportsInstancing ? "supported\n" : "not supported\n" );
320312
stringBuilder.Append( "Motion Vectors: " ).Append( SystemInfo.supportsMotionVectors ? "supported\n" : "not supported\n" );
321313
stringBuilder.Append( "3D Textures: " ).Append( SystemInfo.supports3DTextures ? "supported\n" : "not supported\n" );
322-
#if UNITY_5_6_OR_NEWER
323314
stringBuilder.Append( "3D Render Textures: " ).Append( SystemInfo.supports3DRenderTextures ? "supported\n" : "not supported\n" );
324-
#endif
325315
stringBuilder.Append( "2D Array Textures: " ).Append( SystemInfo.supports2DArrayTextures ? "supported\n" : "not supported\n" );
326316
stringBuilder.Append( "Cubemap Array Textures: " ).Append( SystemInfo.supportsCubemapArrayTextures ? "supported" : "not supported" );
327317

@@ -1205,7 +1195,6 @@ public static bool ParseBounds( string input, out object output )
12051195
return ParseVector( input, typeof( Bounds ), out output );
12061196
}
12071197

1208-
#if UNITY_2017_2_OR_NEWER
12091198
public static bool ParseVector2Int( string input, out object output )
12101199
{
12111200
return ParseVector( input, typeof( Vector2Int ), out output );
@@ -1225,7 +1214,6 @@ public static bool ParseBoundsInt( string input, out object output )
12251214
{
12261215
return ParseVector( input, typeof( BoundsInt ), out output );
12271216
}
1228-
#endif
12291217

12301218
public static bool ParseGameObject( string input, out object output )
12311219
{
@@ -1472,7 +1460,6 @@ private static bool ParseVector( string input, Type vectorType, out object outpu
14721460

14731461
output = new Bounds( center, size );
14741462
}
1475-
#if UNITY_2017_2_OR_NEWER
14761463
else if( vectorType == typeof( Vector3Int ) )
14771464
{
14781465
Vector3Int result = Vector3Int.zero;
@@ -1518,7 +1505,6 @@ private static bool ParseVector( string input, Type vectorType, out object outpu
15181505

15191506
output = new BoundsInt( center, size );
15201507
}
1521-
#endif
15221508
else
15231509
{
15241510
output = null;

Plugins/IngameDebugConsole/Scripts/DebugLogItem.cs

Lines changed: 2 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -12,44 +12,6 @@ namespace IngameDebugConsole
1212
{
1313
public class DebugLogItem : MonoBehaviour, IPointerClickHandler
1414
{
15-
#region Platform Specific Elements
16-
#if !UNITY_2018_1_OR_NEWER
17-
#if !UNITY_EDITOR && UNITY_ANDROID && UNITY_ANDROID_JNI
18-
private static AndroidJavaClass m_ajc = null;
19-
private static AndroidJavaClass AJC
20-
{
21-
get
22-
{
23-
if( m_ajc == null )
24-
m_ajc = new AndroidJavaClass( "com.yasirkula.unity.DebugConsole" );
25-
26-
return m_ajc;
27-
}
28-
}
29-
30-
private static AndroidJavaObject m_context = null;
31-
private static AndroidJavaObject Context
32-
{
33-
get
34-
{
35-
if( m_context == null )
36-
{
37-
using( AndroidJavaObject unityClass = new AndroidJavaClass( "com.unity3d.player.UnityPlayer" ) )
38-
{
39-
m_context = unityClass.GetStatic<AndroidJavaObject>( "currentActivity" );
40-
}
41-
}
42-
43-
return m_context;
44-
}
45-
}
46-
#elif !UNITY_EDITOR && UNITY_IOS
47-
[System.Runtime.InteropServices.DllImport( "__Internal" )]
48-
private static extern void _DebugConsole_CopyText( string text );
49-
#endif
50-
#endif
51-
#endregion
52-
5315
#pragma warning disable 0649
5416
// Cached components
5517
[SerializeField]
@@ -228,16 +190,8 @@ public void CopyLog()
228190
{
229191
#if UNITY_EDITOR || !UNITY_WEBGL
230192
string log = GetCopyContent();
231-
if( string.IsNullOrEmpty( log ) )
232-
return;
233-
234-
#if UNITY_EDITOR || UNITY_2018_1_OR_NEWER || ( !UNITY_ANDROID && !UNITY_IOS )
235-
GUIUtility.systemCopyBuffer = log;
236-
#elif UNITY_ANDROID
237-
AJC.CallStatic( "CopyText", Context, log );
238-
#elif UNITY_IOS
239-
_DebugConsole_CopyText( log );
240-
#endif
193+
if( !string.IsNullOrEmpty( log ) )
194+
GUIUtility.systemCopyBuffer = log;
241195
#endif
242196
}
243197

Plugins/IngameDebugConsole/Scripts/DebugLogManager.cs

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -180,16 +180,12 @@ public class DebugLogManager : MonoBehaviour
180180
private bool receiveLogcatLogsInAndroid = false;
181181

182182
#pragma warning disable 0414
183-
#if UNITY_2018_3_OR_NEWER // On older Unity versions, disabling CS0169 is problematic: "Cannot restore warning 'CS0169' because it was disabled globally"
184183
#pragma warning disable 0169
185-
#endif
186184
[SerializeField]
187185
[HideInInspector]
188186
[Tooltip( "Native logs will be filtered using these arguments. If left blank, all native logs of the application will be logged to the console. But if you want to e.g. see Admob's logs only, you can enter \"-s Ads\" (without quotes) here" )]
189187
private string logcatArguments;
190-
#if UNITY_2018_3_OR_NEWER
191188
#pragma warning restore 0169
192-
#endif
193189
#pragma warning restore 0414
194190

195191
[SerializeField]
@@ -435,9 +431,7 @@ public bool PopupEnabled
435431
// Callbacks for log window show/hide events
436432
public System.Action OnLogWindowShown, OnLogWindowHidden;
437433

438-
#if UNITY_EDITOR
439434
private bool isQuittingApplication;
440-
#endif
441435

442436
#if !UNITY_EDITOR && UNITY_ANDROID && UNITY_ANDROID_JNI
443437
private DebugLogLogcatListener logcatListener;
@@ -564,12 +558,9 @@ private void Awake()
564558
Application.logMessageReceivedThreaded += ReceivedLog;
565559
}
566560

567-
#if UNITY_EDITOR && UNITY_2018_1_OR_NEWER
568561
// OnApplicationQuit isn't reliable on some Unity versions when Application.wantsToQuit is used; Application.quitting is the only reliable solution on those versions
569562
// https://issuetracker.unity3d.com/issues/onapplicationquit-method-is-called-before-application-dot-wantstoquit-event-is-raised
570-
Application.quitting -= OnApplicationQuitting;
571563
Application.quitting += OnApplicationQuitting;
572-
#endif
573564

574565
#if ENABLE_INPUT_SYSTEM && !ENABLE_LEGACY_INPUT_MANAGER
575566
toggleBinding.performed += ( context ) =>
@@ -676,9 +667,7 @@ private void OnDestroy()
676667
if( receiveLogsWhileInactive )
677668
Application.logMessageReceivedThreaded -= ReceivedLog;
678669

679-
#if UNITY_EDITOR && UNITY_2018_1_OR_NEWER
680670
Application.quitting -= OnApplicationQuitting;
681-
#endif
682671
}
683672

684673
#if UNITY_EDITOR
@@ -697,16 +686,12 @@ private void OnValidate()
697686
filterErrorButton.gameObject.SetActive( receiveErrorLogs || receiveExceptionLogs );
698687
}
699688
}
689+
#endif
700690

701-
#if UNITY_2018_1_OR_NEWER
702691
private void OnApplicationQuitting()
703-
#else
704-
private void OnApplicationQuit()
705-
#endif
706692
{
707693
isQuittingApplication = true;
708694
}
709-
#endif
710695

711696
// Window is resized, update the list
712697
private void OnRectTransformDimensionsChange()
@@ -752,10 +737,8 @@ private void Update()
752737

753738
private void LateUpdate()
754739
{
755-
#if UNITY_EDITOR
756740
if( isQuittingApplication )
757741
return;
758-
#endif
759742

760743
int numberOfLogsToProcess = isLogWindowVisible ? queuedLogEntries.Count : ( queuedLogEntries.Count - queuedLogLimit );
761744
ProcessQueuedLogs( numberOfLogsToProcess );
@@ -1059,10 +1042,8 @@ private char OnValidateCommand( string text, int charIndex, char addedChar )
10591042
// A debug entry is received
10601043
public void ReceivedLog( string logString, string stackTrace, LogType logType )
10611044
{
1062-
#if UNITY_EDITOR
10631045
if( isQuittingApplication )
10641046
return;
1065-
#endif
10661047

10671048
switch( logType )
10681049
{
@@ -1828,7 +1809,7 @@ private void CheckScreenCutout()
18281809
if( !avoidScreenCutout )
18291810
return;
18301811

1831-
#if UNITY_2017_2_OR_NEWER && ( UNITY_EDITOR || UNITY_ANDROID || UNITY_IOS )
1812+
#if UNITY_EDITOR || UNITY_ANDROID || UNITY_IOS
18321813
// Check if there is a cutout at the top of the screen
18331814
int screenHeight = Screen.height;
18341815
float safeYMax = Screen.safeArea.yMax;

Plugins/IngameDebugConsole/Scripts/DebugLogPopup.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ public void UpdatePosition( bool immediately )
203203

204204
if( debugManager.popupAvoidsScreenCutout )
205205
{
206-
#if UNITY_2017_2_OR_NEWER && ( UNITY_EDITOR || UNITY_ANDROID || UNITY_IOS )
206+
#if UNITY_EDITOR || UNITY_ANDROID || UNITY_IOS
207207
Rect safeArea = Screen.safeArea;
208208

209209
int screenWidth = Screen.width;

Plugins/IngameDebugConsole/Scripts/EventSystemHandler.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,7 @@ private void OnDisable()
4848

4949
private void OnSceneLoaded( Scene scene, LoadSceneMode mode )
5050
{
51-
#if UNITY_2017_2_OR_NEWER
5251
DeactivateEventSystem();
53-
#endif
5452
ActivateEventSystemIfNeeded();
5553
}
5654

0 commit comments

Comments
 (0)