Hi,
Need your help figuring this out.
I have a Plugin that has a c++ class deriving from a UObject with a UFunction in it. This UFunction is declared as static and I can see this Ufunction from a blueprint. For some reason, I can’t see this function being executed.
Thanks
Here is a sceenshot of this function visible in BluePrint:
Here is my header code:
// Copyright 1998-2016 HazardNetworking, Inc. All Rights Reserved.
#pragma once
#if PLATFORM_ANDROID
#include <jni.h>
#include "Android/AndroidJNI.h"
#include "Android/AndroidJava.h"
#include "Android/AndroidApplication.h"
#include <Android/asset_manager.h>
#include <Android/asset_manager_jni.h>
#endif
#include "MyPluginObject.generated.h"
//General Log
DECLARE_LOG_CATEGORY_EXTERN(KarmikLog, Log, All);
UCLASS(Blueprintable, BlueprintType )
class UMyPluginObject : public UObject
{
GENERATED_UCLASS_BODY()
public:
UFUNCTION( BlueprintCallable, BlueprintPure, Category = Karmik)
static FString callMapsActivity(FString hazardID, FString hazardDescription );
#if PLATFORM_ANDROID
static void AndroidThunkCpp_callMapsActivity();
#endif
private:
UPROPERTY()
FMyPluginStruct MyStruct;
};
Here is my source file:
// Copyright 1998-2016 HazardNetworking, Inc. All Rights Reserved.
#include "UObjectPluginPrivatePCH.h"
#include "MyPluginObject.h"
#if PLATFORM_ANDROID
#include <jni.h>
#include "Android/AndroidJNI.h"
#include "Android/AndroidJava.h"
#include "Android/AndroidApplication.h"
#include <Android/asset_manager.h>
#include <Android/asset_manager_jni.h>
#endif
//General Log
DEFINE_LOG_CATEGORY(KarmikLog);
UMyPluginObject::UMyPluginObject( const FObjectInitializer& ObjectInitializer )
: Super( ObjectInitializer )
{
}
// This is being called from the BluePrint
FString UMyPluginObject::callMapsActivity(FString hazardID, FString hazardDescription )
{
AndroidThunkCpp_callMapsActivity()
#if PLATFORM_ANDROID
UE_LOG(KarmikLog, Warning, TEXT("Calling method: AndroidThunkCpp_callMapsActivity"));
AndroidThunkCpp_callMapsActivity();
#endif
return "Called JNI method: AndroidThunkCpp_callMapsActivity";
}
#if PLATFORM_ANDROID
void UMyPluginObject::AndroidThunkCpp_callMapsActivity()
{
// This will call the java method to invoke MapsActivity
if (JNIEnv* Env = FAndroidApplication::GetJavaEnv())
{
// Do Something
}
}
#endif