コード例 #1
0
SVisualLogger::~SVisualLogger()
{
	UWorld* World = NULL;
#if WITH_EDITOR
	FCategoryFiltersManager::Get().SavePresistentData();

	UEditorEngine *EEngine = Cast<UEditorEngine>(GEngine);
	if (GIsEditor && EEngine != NULL)
	{
		// lets use PlayWorld during PIE/Simulate and regular world from editor otherwise, to draw debug information
		World = EEngine->PlayWorld != NULL ? EEngine->PlayWorld : EEngine->GetEditorWorldContext().World();

	}
	else
#endif
	if (!GIsEditor)
	{
	World = GEngine->GetWorld();
	}

	if (World == NULL)
	{
		World = GWorld;
	}

	if (World)
	{
		for (TActorIterator<AVisualLoggerRenderingActor> It(World); It; ++It)
		{
			World->DestroyActor(*It);
		}
	}

	UDebugDrawService::Unregister(DrawOnCanvasDelegateHandle);
	VisualLoggerCanvasRenderer.Reset();

	FVisualLogger::Get().RemoveDevice(InternalDevice.Get());
	InternalDevice.Reset();
}
コード例 #2
0
UWorld* FLogVisualizer::GetWorld(UObject* OptionalObject)
{
    UWorld* World = OptionalObject != nullptr ? GEngine->GetWorldFromContextObject(OptionalObject, false) : nullptr;
#if WITH_EDITOR
    if (!World && GIsEditor)
    {
        UEditorEngine *EEngine = Cast<UEditorEngine>(GEngine);
        // lets use PlayWorld during PIE/Simulate and regular world from editor otherwise, to draw debug information
        World = EEngine != nullptr && EEngine->PlayWorld != nullptr ? EEngine->PlayWorld : EEngine->GetEditorWorldContext().World();

    }
    else
#endif
        if (!World && !GIsEditor)
        {

            World = GEngine->GetWorld();
        }

    if (World == nullptr)
    {
        World = GWorld;
    }

    return World;
}