Is it possible somehow to bind a Input key event to a function in my custom ActorComponent?
Something like this:
InputComponent->BindAction(“MoveForward”, IE_Released, this,&UMyActorComponent::Something);
Is it possible somehow to bind a Input key event to a function in my custom ActorComponent?
Something like this:
InputComponent->BindAction(“MoveForward”, IE_Released, this,&UMyActorComponent::Something);
As far as i know, the “SetPlayerInputComponent” function is only available inside the APawn, ACharacter and ADefaultPawn classes. I’m not that skilled in c++ so i can’t say if it is possible or not to bind this (maybe just test it? :D).
But what about binding a normal function to it, like you would do normaly and just call “Something” inside this bound function? Would that be a workaround?
I guess it is but it doesn’t look good
You should be able to from a purely C++ standpoint. I don’t know how the BindAction function will react to it though. The pointer you will have to pass on is a pointer to the component instead of the this pointer. Alternatively, you should be able to make a delegate out of any function and use the bindaction with that delegate.
I guess the way to go is with delegates. Thanks for the input!