hi,
after package for android I got:
MyUserWidget.cpp(11,38): error: use of undeclared identifier ‘FJavaWrapper’
This I got problem only in if use custom widget, if used actor works…
Build in VS works ok, in UE4 in output log I got error.
My code:
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Blueprint/UserWidget.h"
#include "MyUserWidget.generated.h"
/**
*
*/
UCLASS()
class MYPROJECT11_API UMyUserWidget : public UUserWidget
{
GENERATED_BODY()
UFUNCTION(BlueprintCallable)
void ToggleOrientation();
};
#include "MyUserWidget.h"
void UMyUserWidget::ToggleOrientation()
{
#if PLATFORM_ANDROID || PLATFORM_IOS
JNIEnv* JE = FAndroidApplication::GetJavaEnv();
jmethodID SetOrientationID = FJavaWrapper::FindMethod(JE, FJavaWrapper::GameActivityClassID, "setRequestedOrientation", "(I)V", false);
FJavaWrapper::CallVoidMethod(JE, FJavaWrapper::GameActivityThis, SetOrientationID, 0);
#else
#endif
}