Skip to content

Commit 5b25e1f

Browse files
committed
Fixed customcommands not showing commands created using the attribute method.
1 parent f8d261c commit 5b25e1f

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010
- Added helper method for logging a collection in list format.
1111
- Changed command suggestions / autocomplete to also work with aliases.
1212
- Fixed issues with displaying logs that exceed the rendering limit.
13+
- Fixed issue with "customcommands" not showing commands created via the attribute method.
1314

1415
## [0.1.9-alpha] - 2021-08-05
1516
- Added events for when the console is enabled/disabled, opened/closed and focused/unfocused.

Runtime/DevConsole.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ public static bool AddCommand(Command command, bool onlyInDevBuild = false)
126126
throw new ArgumentNullException(nameof(command));
127127
}
128128

129-
return _console.AddCommand(command, onlyInDevBuild);
129+
return _console.AddCommand(command, onlyInDevBuild, true);
130130
}
131131

132132
/// <summary>

Runtime/DevConsoleMono.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ internal bool RunCommand(string rawInput)
428428
return true;
429429
}
430430

431-
internal bool AddCommand(Command command, bool onlyInDevBuild = false)
431+
internal bool AddCommand(Command command, bool onlyInDevBuild = false, bool isCustomCommand = false)
432432
{
433433
if (onlyInDevBuild && !Debug.isDebugBuild)
434434
{
@@ -446,7 +446,7 @@ internal bool AddCommand(Command command, bool onlyInDevBuild = false)
446446
{
447447
_commands.Add(command.Name, command);
448448

449-
if (!_init)
449+
if (isCustomCommand)
450450
{
451451
command.SetAsCustomCommand();
452452
}
@@ -1863,7 +1863,7 @@ private void InitAttributeCommands()
18631863
DevConsoleCommandAttribute commandAttribute = (DevConsoleCommandAttribute)attribute;
18641864
if (commandAttribute != null)
18651865
{
1866-
AddCommand(Command.Create(commandAttribute, method), commandAttribute.OnlyInDevBuild);
1866+
AddCommand(Command.Create(commandAttribute, method), commandAttribute.OnlyInDevBuild, true);
18671867
}
18681868
}
18691869
}

0 commit comments

Comments
 (0)