Closed billw2012 closed 3 years ago
Yes I'm aware of this limitation. That's why I like the DebugLogConsole.AddCommand functions. I'm inspecting only Assembly-CSharp purely for performance reasons. I fear including all assemblies in the search would take significantly more time and it would be unpreferable for users who aren't interested in custom commands.
A few things you could consider:
Simply add IngameDebugConsole.ConsoleMethod attribute to your functions. These functions must be public, static and must reside in a public class in the Assembly-CSharp.dll assembly (i.e. if your code is in custom assemblies, as will happen if you use asmdefs, the attributes will not be detected).
I tried to optimize the assembly list and could only get it down to ~25ms by excluding modules based on name prefix (which isn't bullet proof), and company attribute value. This still left 14 out of 120 assemblies, all my plugins and game code. Its a shame that module attributes are so inconsistently applied. e.g. having one generated automatically for each asmdef module would help in this case, but there isn't any such thing.
I've omitted most of the built-in assemblies from the search. Hopefully it will be pretty fast.
I use asmdefs for my game code, and so ConsoleMethodAttribute will not work. I changed your code to this and it works for me now: