Access Kismet Library in UObject based blueprint

I have a C++ class derived from UObject and blueprint class derived from that c++ class. How ever I do not have access to kismet libraries such as GetPlayerCharacter or PlaySound, etc… in blueprint graph.

I could manually provide functions that I need one by one in c++. But I feel like this is wrong and should be much simpler. Any Ideas how to solve this? can I customize with plugin?

1 Like

I was able to fix this problem by copying this method from BTNode

UWorld* UMyCustomType::GetWorld() const
{
	if (GetOuter() == nullptr)
	{
		return nullptr;
	}

	// Special case for behavior tree nodes in the editor
	if (Cast<UPackage>(GetOuter()) != nullptr)
	{
		// GetOuter should return a UPackage and its Outer is a UWorld
		return Cast<UWorld>(GetOuter()->GetOuter());
	}

	// In all other cases...
	return GetOuter()->GetWorld();
}

Basically override GetWorld like this and graph editor will magically show kismet functions for you!

3 Likes