What am I missing here? UFUNCTION(exec), console function

Hey,

I just want to mark a function as exec so I can write the function name in the console and have some code executing for testing purposes.
In UnrealScript you just wrote “exec function …”.
Now I understand I have to mark my function in the header via
UFUNCTION(exec)

So what I did was this:

  • Header file:

UFUNCTION(exec)
		void TestFunc(bool value);

  • Main file:

void AShooterWeapon::TestFunc(bool value)
{
	..do smth with "value"..

}

So the function “TestFunc” shows up in console but it says it cannot find the function… What am I missing?

Only certain classes can contain ‘exec’ functions. I’m afraid I can’t find a full list right now, but I know Pawn, PlayerController, CheatManager, GameMode, PlayerInput & HUD are some of them.

Right, it says so on the exec keyword documenation page but no mention of which classes those are. I now remember it was like this with UE3 aswell. Thanks James!