How to use FAutoConsoleCommand to trigger a member function of an object instance?

Hi,
According to the UE documentation, it is possible to use FAutoConsoleCommand to register and unregister the console command automatically.

So far I have tested that If I declare the FAutoConsoleCommand as a static member in a class, and initiate it a FConsoleCommandDelegate binded to a static member function, it works.
But If I declare the FAutoConsoleCommand as a non-static member in a class, the compiler will throw out an error of “error C2512: ‘FAutoConsoleCommand’: no appropriate default constructor available”.
If I declare it as a static member and initiate it a FConsoleCommandDelegate binded to a object instance member function, the compiling will fail too.

So, what is the correct way of using FAutoConsoleCommand? Is it possible to register a console command by FAutonConsoleCommand to trigger a object instance memeber function?

BTW, If I use the FConsoleManager::Get().RegisterConsoleCommand to register the console command with a FConsoleCommandDelegate binded to a member function of a object instance, it also works.

But I want to know how to manage it with the FAutoConsoleCommand.

Thanks.

1>[3/8] Compile [x64] MyObject.gen.cpp
1>D:\UnrealProjects\MPShooterEOS\Intermediate\Build\Win64\UnrealEditor\Inc\MPShooterEOS\UHT\MyObject.gen.cpp(75): error C2512: ‘FAutoConsoleCommand’: no appropriate default constructor available
1>E:\UE521\Engine\Source\Runtime\Core\Public\HAL\IConsoleManager.h(1716): note: see declaration of ‘FAutoConsoleCommand’
1>[4/8] Compile [x64] MyObject.cpp
1>D:\Unreal Projects\MPShooterEOS\Source\MPShooterEOS\Private\MyObject.cpp(10): error C2512: ‘FAutoConsoleCommand’: no appropriate default constructor available
1>E:\UE521\Engine\Source\Runtime\Core\Public\HAL\IConsoleManager.h(1716): note: see declaration of ‘FAutoConsoleCommand’

If anyone knows where to find relevant sample code, please help share it. Thank you

well the error log speaks for itself, there is no default constructor for FAutoConsoleCommand. you need to construct the testCmd in the initializer list in UMyObject constructor

UMyObject::UMyObject() : testCmd(TEXT("testcmd::testcmd"), TEXT("test cmd"). cmdDelegate) {}

well that assumes that cmdDelegate is set up before the construction of UMyObject/ or in the initializer list.

But this can be every messy to read, in my case i have multiple of these commands, so I created a array of FAutoConsoleCommand and added to the array a new FAutoConsoleCommand(TEXT(“testcmd::testcmd”), TEXT(“test cmd”), cmdDelegate) during runtime so that i have time to setup cmdDelegate.

But i cant seem to bind a member function of a object instance, so i used lambdas.