"Get Game Mode" and "Get Player Controller" nodes don't show up

So, I’ve an UObject created in C++ and I’m trying to script in blueprint a UFunction with the BlueprintNativeEvent specifier.
Thing is, the nodes “Get Game Mode” and “Get Player Controller” don’t show up on the graph.

I tried unchecking the context sensitivity but it doesn’t work. If I try to copy the nodes from another actor and paste them on this object I only get the message “conflicting nodes substituted during paste!” even if there are no nodes on the graph.

The issue is that it inherits from UObject, not AActor or such.

GetGameMode is part of UGamePlayStatics

It requires WorldContextObject to function.

And here someone seems to have been able to “fix” the issue

Or just inherit from AActor instead or choose another approach.

thank you, I tried the fix you posted and it seems to work just fine.