command_terminal
command_terminal copied to clipboard
Static methods not called if asset is in the /Plugins/ folder
Hello!
I'm having trouble having static methods appear in the help-command, or being able to run at all if I have Command Terminal-folder in the /Plugins/ folder. Command Terminal works if it is outside the /Plugins/ folder.
My code:
using CommandTerminal;
public static class DebugTestCommand {
[RegisterCommand(Help = "Outputs message")]
static void CommandHello (CommandArg[] args) {
Terminal.Log("Hello world!");
}
}
Hi!
The Plugins folder compiles to a separate assembly. Right now the RegisterCommand
attribute only works in the main assembly (source).
Try registering the command manually using Terminal.Shell.AddCommand
.
I'll look into supporting separate assemblies.
I've fixed this issue in my fork of Command Terminal. @stillwwater, if you want to do this it's very simple. On line 35 of CommandShell.cs
, do this:
foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies()) {
foreach (var type in assembly.GetTypes()) {
instead of this:
foreach (var type in Assembly.GetExecutingAssembly().GetTypes()) {