mirror of
https://github.com/kevinporetti/UnrealImGui.git
synced 2025-01-18 08:20:32 +00:00
Fixed crash in editor-preview worlds, introduced in the last commit.
This commit is contained in:
parent
848e7294c8
commit
91080c3988
@ -13,6 +13,8 @@
|
|||||||
#include <imgui.h>
|
#include <imgui.h>
|
||||||
|
|
||||||
|
|
||||||
|
// TODO: Refactor ImGui Context Manager, to handle different types of worlds.
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
#if WITH_EDITOR
|
#if WITH_EDITOR
|
||||||
@ -107,7 +109,8 @@ void FImGuiContextManager::OnWorldTickStart(ELevelTick TickType, float DeltaSeco
|
|||||||
|
|
||||||
void FImGuiContextManager::OnWorldTickStart(UWorld* World, ELevelTick TickType, float DeltaSeconds)
|
void FImGuiContextManager::OnWorldTickStart(UWorld* World, ELevelTick TickType, float DeltaSeconds)
|
||||||
{
|
{
|
||||||
if (World)
|
if (World && (World->WorldType == EWorldType::Game || World->WorldType == EWorldType::PIE
|
||||||
|
|| World->WorldType == EWorldType::Editor))
|
||||||
{
|
{
|
||||||
FImGuiContextProxy& ContextProxy = GetWorldContextProxy(*World);
|
FImGuiContextProxy& ContextProxy = GetWorldContextProxy(*World);
|
||||||
|
|
||||||
@ -123,9 +126,13 @@ void FImGuiContextManager::OnWorldTickStart(UWorld* World, ELevelTick TickType,
|
|||||||
|
|
||||||
#if ENGINE_COMPATIBILITY_WITH_WORLD_POST_ACTOR_TICK
|
#if ENGINE_COMPATIBILITY_WITH_WORLD_POST_ACTOR_TICK
|
||||||
void FImGuiContextManager::OnWorldPostActorTick(UWorld* World, ELevelTick TickType, float DeltaSeconds)
|
void FImGuiContextManager::OnWorldPostActorTick(UWorld* World, ELevelTick TickType, float DeltaSeconds)
|
||||||
|
{
|
||||||
|
if (World && (World->WorldType == EWorldType::Game || World->WorldType == EWorldType::PIE
|
||||||
|
|| World->WorldType == EWorldType::Editor))
|
||||||
{
|
{
|
||||||
GetWorldContextProxy(*World).DrawDebug();
|
GetWorldContextProxy(*World).DrawDebug();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif // ENGINE_COMPATIBILITY_WITH_WORLD_POST_ACTOR_TICK
|
#endif // ENGINE_COMPATIBILITY_WITH_WORLD_POST_ACTOR_TICK
|
||||||
|
|
||||||
#if WITH_EDITOR
|
#if WITH_EDITOR
|
||||||
@ -163,7 +170,8 @@ FImGuiContextManager::FContextData& FImGuiContextManager::GetWorldContextData(co
|
|||||||
using namespace Utilities;
|
using namespace Utilities;
|
||||||
|
|
||||||
#if WITH_EDITOR
|
#if WITH_EDITOR
|
||||||
if (World.WorldType == EWorldType::Editor)
|
// Default to editor context for anything other than a game world.
|
||||||
|
if (World.WorldType != EWorldType::Game && World.WorldType != EWorldType::PIE)
|
||||||
{
|
{
|
||||||
if (OutIndex)
|
if (OutIndex)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user