コード例 #1
0
ファイル: UserWidget.cpp プロジェクト: kidaa/UnrealEngineVR
UWorld* UUserWidget::GetWorld() const
{
	if ( HasAllFlags(RF_ClassDefaultObject) )
	{
		// If we are a CDO, we must return nullptr instead of calling Outer->GetWorld() to fool UObject::ImplementsGetWorld.
		return nullptr;
	}

	// Use the Player Context's world, if a specific player context is given, otherwise fall back to
	// following the outer chain.
	if ( PlayerContext.IsValid() )
	{
		if ( UWorld* World = PlayerContext.GetWorld() )
		{
			return World;
		}
	}

	// Could be a GameInstance, could be World, could also be a WidgetTree, so we're just going to follow
	// the outer chain to find the world we're in.
	UObject* Outer = GetOuter();

	while ( Outer )
	{
		UWorld* World = Outer->GetWorld();
		if ( World )
		{
			return World;
		}

		Outer = Outer->GetOuter();
	}

	return nullptr;
}
コード例 #2
0
FGuid ULevelSequence::FindPossessableObjectId(UObject& Object) const
{
	return ObjectReferences.FindBindingId(&Object, Object.GetWorld());
}