Hey i am trying to get call back functions from java to work (GameActivity.java).
I have been able to successfully do this when the callback takes no parameters but cannot figure out the correct way to define it when the function returns a bool.
GameActivity.java
public native void nativeMyCallbackFunc(boolean myReturnVal);
AndroidJNI.h
DECLARE_MULTICAST_DELEGATE_OneParam(FOnMyCallbackFunc, jboolean);
class FJavaWrapper
{
.....
static FOnMyCallbackFunc OnMyCallbackFunc;
AndroidJNI.cpp
FOnMyCallbackFunc JavaWrapper::OnMyCallbackFunc;
.....
extern "C" void Java_com_epicgames_ue4_GameActivity_nativeMyCallbackFunc(jboolean myReturnVal)
{
FJavaWrapper::OnMyCallbackFunc.Broadcast(myReturnVal);
}
MyActor.h
UFUNCTION(BlueprintNativeEvent, Category = "MyEvents")
void OnMycallbackFunc(bool myReturnVal);
void OnMycallbackFunc_Implementation(bool myReturnVal);
MyActor.cpp
void AMyActor::BeginPlay()
{
.....
FJavaWrapper::OnMyCallbackFunc.AddUObject(this, &AMyActor::OnMycallbackFunc);
}
It doesn’t like the AddUObject part and i think it is to do with the bool but i’m not sure how to define it as if i do a function callback with no paramaters using
DECLARE_MULTICAST_DELEGATE(FMycallbackFunc);
and AddUObject as above it works and fires off when used in blueprint.
Thanks