UEngine::GetWorldFromContextObject

Obtain a world object pointer from an object with has a world context.

Choose your operating system:

Windows

macOS

Linux

References

Module

Engine

Header

/Engine/Source/Runtime/Engine/Classes/Engine/Engine.h

Include

#include "Engine/Engine.h"

Source

/Engine/Source/Runtime/Engine/Private/UnrealEngine.cpp

Syntax

UWorld * GetWorldFromContextObject
(
    const UObject * Object,
    EGetWorldErrorMode ErrorMode
) const

Remarks

Obtain a world object pointer from an object with has a world context.

Returns

The world to which the object belongs or nullptr if it cannot be found.

Parameters

Parameter

Description

Object

Object whose owning world we require.

ErrorMode

Controls what happens if the Object cannot be found