// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Kismet/BlueprintFunctionLibrary.h"
#include "OverrideR.generated.h"
/**
*
*/
UCLASS()
class MYPROJECT_API UOverrideR : public UBlueprintFunctionLibrary
{
GENERATED_BODY()
UFUNCTION(BlueprintCallable, Category = "Rendering")
static void RunExec(FString Command);
};
than
// Fill out your copyright notice in the Description page of Project Settings.
#include "OverrideR.h"
void UOverrideR::RunExec(FString Command)
{
/* GEngine->Exec(GetWorld(), TEXT("%s"), *Command); <<< "*Command" return invalid */
GEngine->Exec(GetWorld(), TEXT("r.BoloomQuality=0"));
}
This is a macro that is not able to get the World to run console commands.
Oh yeah you are using it in a library so it’s static. You need to pass in a world context object in the static function (just pass in a UObject reference) and get the world from the passed object.
thank you very much for your help, just a doubt what exactly would the object be? Level name or class controller? Sorry for the bad question, because I’m not a programmer in C++, only in C# and “Blueprints”.
it can be anything that inherits from uobject (so nearly any basic class in unreal as it’s the base class)
p.s.
you have a typo in your command. You wrote BoloomQuality instead of BloomQuality
try it without the equals sign:
r.BloomQuality 0
r.BloomQuality 1
Also seems like calling it on basic uobjects doesn’t always work, but pushing it to the player controller seems to work a 100% of the time
Yes, it worked, I was using r.BloomQuality=0 and the terminal was saying that the command was unknown, I thought that the default “Execute Console Command” from ue4 Blueprints did not accept certain commands and so I decided to create a custom function in C++, but I was wrong. Thanks a lot for the help. If you want to know the context of me wanting this is in this topic kkkk: Brute force override rendering settings.