Accessing FunctionLibrary/GameplayStatics in UObjectextended class

Hi there.

I extended a UObject class and further extend them in BP.

However I noticed that I’m unable to access gameplaystatics or all those kismet function library. ( GetGameMode, GetGameState etc )

. This is despite already doing these :

#include “Object.h”
#include “Runtime/AIModule/Classes/BehaviorTree/Tasks/BTTask_BlueprintBase.h”
#include “Kismet/GameplayStatics.h”
#include “Kismet/BlueprintFunctionLibrary.h”
#include “OrderObject_Base.generated.h”

A lot of the library functions use a WorldContextObject and the engine’s default behavior is to hide any function that uses it when in a blueprint graph of an object that does not override GetWorld(). Just override the function and make sure to handle the CDO case (you can just do a call to check if the CDO flag is set or not).

	virtual UWorld* GetWorld() const override
	{
		if (HasAllFlags(RF_ClassDefaultObject))
		{
			return nullptr;
		}
		return GetOuter()->GetWorld();
	}

The other option is to add meta = (ShowWorldContextPin) to the UCLASS declaration.