Wow, that’s a weird behavior. But it works now, so thank you.
In the end i opted to use FString as a parameter but the weird thing is that it still requires to be const address, which leads me to question how UHT determines interfaces, if you have any knowledge of this i would be happy to hear it
As for removing UFUNCTION macro i could only remove it in the derived class that implements the interface, NOT in the interface (that’s for anyone who’s looking for answers)
And yeah as for why i wanted to use UWorld i have a TMap of all levels that can load but didn’t think of simply using FString to find by key which is honestly my fault
The end result:
BaseLevelManager.h
#include "CoreMinimal.h"
#include "UObject/NoExportTypes.h"
#include "BaseLevelManager.generated.h"
/**
*
*/
UINTERFACE(BlueprintType)
class UBaseLevelManager : public UInterface
{
GENERATED_BODY()
};
class IBaseLevelManager
{
GENERATED_BODY()
public:
UFUNCTION(BlueprintCallable, BlueprintNativeEvent, Category="Interface")
void LoadMainMenu();
UFUNCTION(BlueprintCallable, BlueprintNativeEvent, Category="Interface")
void UnloadMainMenu();
UFUNCTION(BlueprintCallable, BlueprintNativeEvent, Category="Interface")
void LoadTargetLevel(const FString& TargetLevel);
UFUNCTION(BlueprintCallable, BlueprintNativeEvent, Category="Interface")
void UnloadTargetLevel(const FString& TargetLevel);
};
BaseGamemode.h
UCLASS()
class PROJECTREBIS_API ABaseGamemode : public AGameMode, public IBaseLevelManager
{
GENERATED_BODY()
public:
UPROPERTY(BlueprintReadWrite, EditDefaultsOnly, Category="Default")
TMap<FString, TSoftObjectPtr<UWorld>> LevelsArray;
UPROPERTY(BlueprintReadWrite, EditAnywhere, Category="Default")
UWorld* CurrentLevel;
public:
UFUNCTION(BlueprintCallable, BlueprintNativeEvent, Category="Interface")
void LoadMainMenu();
virtual void LoadMainMenu_Implementation() override;
UFUNCTION(BlueprintCallable, BlueprintNativeEvent, Category="Interface")
void UnloadMainMenu();
virtual void UnloadMainMenu_Implementation() override;
void LoadTargetLevel(const FString& TargetLevel);
virtual void LoadTargetLevel_Implementation(const FString& TargetLevel);
void UnloadTargetLevel(const FString& TargetLevel);
virtual void UnloadTargetLevel_Implementation(const FString& TargetLevel);
};