Skip to content

Commit c6af7bd

Browse files
committed
Removed all built-in commands except 'help' (#92) (reverted #54). It's better to have these commands opt-in rather than opt-out. Built-in commands can be reactivated by adding IDB_ENABLE_HELPER_COMMANDS compiler directive in Player Settings
1 parent 55a7455 commit c6af7bd

File tree

5 files changed

+21
-9
lines changed

5 files changed

+21
-9
lines changed

Plugins/IngameDebugConsole/Scripts/Commands/PlayerPrefsCommands.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using UnityEngine;
1+
#if IDG_ENABLE_HELPER_COMMANDS
2+
using UnityEngine;
23

34
namespace IngameDebugConsole.Commands
45
{
@@ -55,4 +56,5 @@ public static void PlayerPrefsClear()
5556
PlayerPrefs.DeleteAll();
5657
}
5758
}
58-
}
59+
}
60+
#endif

Plugins/IngameDebugConsole/Scripts/Commands/SceneCommands.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using UnityEngine;
1+
#if IDG_ENABLE_HELPER_COMMANDS
2+
using UnityEngine;
23
using UnityEngine.SceneManagement;
34

45
namespace IngameDebugConsole.Commands
@@ -55,4 +56,5 @@ public static void RestartScene()
5556
SceneManager.LoadScene( SceneManager.GetActiveScene().name, LoadSceneMode.Single );
5657
}
5758
}
58-
}
59+
}
60+
#endif

Plugins/IngameDebugConsole/Scripts/Commands/TimeCommands.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using UnityEngine;
1+
#if IDG_ENABLE_HELPER_COMMANDS
2+
using UnityEngine;
23

34
namespace IngameDebugConsole.Commands
45
{
@@ -16,4 +17,5 @@ public static float GetTimeScale()
1617
return Time.timeScale;
1718
}
1819
}
19-
}
20+
}
21+
#endif

Plugins/IngameDebugConsole/Scripts/DebugLogConsole.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,13 @@ public static class DebugLogConsole
126126

127127
static DebugLogConsole()
128128
{
129+
#if !IDG_DISABLE_HELP_COMMAND
129130
AddCommand( "help", "Prints all commands", LogAllCommands );
130131
AddCommand<string>( "help", "Prints all matching commands", LogAllCommandsWithName );
132+
#endif
133+
#if IDG_ENABLE_HELPER_COMMANDS || IDG_ENABLE_SYSINFO_COMMAND
131134
AddCommand( "sysinfo", "Prints system information", LogSystemInfo );
135+
#endif
132136

133137
#if UNITY_EDITOR || !NETFX_CORE
134138
// Find all [ConsoleMethod] functions
@@ -1518,4 +1522,4 @@ private static bool ParseVector( string input, Type vectorType, out object outpu
15181522
return true;
15191523
}
15201524
}
1521-
}
1525+
}

Plugins/IngameDebugConsole/Scripts/DebugLogManager.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -590,8 +590,10 @@ private void OnEnable()
590590
#endif
591591
}
592592

593+
#if IDG_ENABLE_HELPER_COMMANDS || IDG_ENABLE_LOGS_SAVE_COMMAND
593594
DebugLogConsole.AddCommand( "logs.save", "Saves logs to persistentDataPath", SaveLogsToFile );
594595
DebugLogConsole.AddCommand<string>( "logs.save", "Saves logs to the specified file", SaveLogsToFile );
596+
#endif
595597

596598
#if ENABLE_INPUT_SYSTEM && !ENABLE_LEGACY_INPUT_MANAGER
597599
if( toggleWithKey )
@@ -1759,12 +1761,12 @@ public string GetAllLogs()
17591761
return sb.ToString();
17601762
}
17611763

1762-
private void SaveLogsToFile()
1764+
public void SaveLogsToFile()
17631765
{
17641766
SaveLogsToFile( Path.Combine( Application.persistentDataPath, System.DateTime.Now.ToString( "dd-MM-yyyy--HH-mm-ss" ) + ".txt" ) );
17651767
}
17661768

1767-
private void SaveLogsToFile( string filePath )
1769+
public void SaveLogsToFile( string filePath )
17681770
{
17691771
File.WriteAllText( filePath, GetAllLogs() );
17701772
Debug.Log( "Logs saved to: " + filePath );

0 commit comments

Comments
 (0)