What i have:
*.CPP file :
StaticMesh->OnInputTouchBegin.AddDynamic(this, &AOxygenStorage::OnTouchBegin);
void AOxygenStorage::OnTouchBegin(ETouchIndex::Type FingerIndex, UPrimitiveComponent* TouchedComponent)
{
UE_LOG(LogTemp, Warning, TEXT(“Mesh is touched”));
}
*.h file :
UFUNCTION()
void OnTouchBegin(ETouchIndex::Type FingerIndex, UPrimitiveComponent* TouchedComponent);
As a result I can’t see log.
Do you need to setup touch behavior in the player controller, too? It has bEnableTouchEvents
, bEnableTouchOverEvents
, ActivateTouchInterface
, and other stuff related to touch evens.
Honestly ,my programming level is very low and i don’t know how set up player controller via c++.
But , I set EnableTouchEvents and EnableTouchOverEvents to true via blueprint.(It did’t help)
And more , when i set up OnInputTouchBegin with BP - all work, even without set up player controller
I would be grateful if you say where I can get more information about setup player controller via c++.
Before that, I have another option. Is the call to AddDynamic in the constructor or BeginPlay? If it’s in the constructor, try moving it into BeginPlay. I had an issue in which my bindings (from the pawn sensor component) were not being called unless they were in BeginPlay, I also read somewhere they’re supposed to be in BeginPlay.
I try move AddDynamic from constructor to begin blay , but this has no effect.
I set up player controller with c++ , but this has also no effect.
Thanks for the help, I started a new project and now everything works.
I started a new project and now everything works.