I have a weird problem with Inputs. I defined an Input and I can use it in Blueprints, but I can’t use it from c++.
I don’t get an error, but the function isn’t called. It neither works with my pawn.
Here my code:
I know this sounds stupid, but do you ever “activate” (press the button bound to) your “Forward”? I am assuming it is properly setup in your project settings since you can use it in blueprints.
make sure void Build(); is declared as a public method in PlayerControllerRTS.h
In your Project settings > Input please make sure that under Action mappings you have added a mapping called Forward
Make sure that your InputComponent class hasn’t been subclassed and you are using the wrong Input component class.
Add EnableInput(this) somewhere before if (InputComponent) in APlayerControllerRTS::SetupInputComponent() (you shouldnt need this but to be extra safe)
make sure void Build(); is declared as a public method in PlayerControllerRTS.h
In your Project settings > Input please make sure that under Action mappings you have added a mapping called Forward
Make sure that your InputComponent class hasn’t been subclassed and you are using the wrong Input component class.
Add EnableInput(this) somewhere before if (InputComponent) in APlayerControllerRTS::SetupInputComponent() (you shouldnt need this but to be extra safe)
I added EnableInput(this) - didn’t change anything, maybe worth noting: VA gives it the color for Classes and not for functions - EDIT: UE Log says: “Error: EnableInput can only be specified on a Pawn for its Controller”
I tried copying everything I thought would be useful out of the example and didn’t work.
I copied the whole example and just changed API name and deleted the widget stuff and created inputs with the right names, still not working.
Update: I just want to hang myself. After hours of searching and trying it in new project i noticed that it is because i missed the “Super::PlayerTick(DeltaTime);” in my PlayerTick. I don’t know how my stuff in the tick function worked perfectly when i missed this all the time.
Also I don’t know if I should be happy now or not.