Download

How to get gamemode/world pointer from uobject

How do i get pointer to gamemode or pointer to world from inside a UObject.

From an actor its easy, but cant seem to find any options for getting any of those pointer from inside UObject derived class.

(Side NOte)
Dont know about the new version tag confusion was made to select 4-27 to get this post submit, i am actually using ue5, not that its relevant to this question.

cheers

GEngine->GetWorldFromContextObject( WorldContext, EGetWorldErrorMode::LogAndReturnNull ) is generally the standard way that functions figure out the world from random UObjects in any of the places where a WorldContext is passed in. You could call that with this for the first param and whichever enumeration value you feel is most appropriate.

GEngine->GetWorldFromContextObject( this, EGetWorldErrorMode::LogAndReturnNull ) 

Thanks a million that did it