JoshuaLim007 / InGameConsole

In game console for Unity
GNU General Public License v3.0
37 stars 3 forks source link

Cant overload console command methods #2

Open Seathus opened 3 years ago

Seathus commented 3 years ago

Looks like we can't overload command methods. Is this intended? Error is thrown when I attempt to do so:

ArgumentException: An item with the same key has already been added. Key: setspell System.Collections.Generic.Dictionary2[TKey,TValue].TryInsert (TKey key, TValue value, System.Collections.Generic.InsertionBehavior behavior) (at <9577ac7a62ef43179789031239ba8798>:0) System.Collections.Generic.Dictionary2[TKey,TValue].Add (TKey key, TValue value) (at <9577ac7a62ef43179789031239ba8798>:0) Lim.InGameConsole.IGC_Main.GetMethods (System.Reflection.Assembly assembly) (at Library/PackageCache/com.limjoshua.igconsole@c7a5120089/Runtime/IGC_Main.cs:101) Lim.InGameConsole.IGC_Main.Awake () (at Library/PackageCache/com.limjoshua.igconsole@c7a5120089/Runtime/IGC_Main.cs:45)

JoshuaLim007 commented 3 years ago

Commands need to situated in a unique class name and a unique method name within the class because it's stored in a dictionary by name. So as of now there is no overloading.