A Demo Project for the UnrealEngineSDK
Loading...
Searching...
No Matches
DlgObject.cpp
Go to the documentation of this file.
1// Copyright Csaba Molnar, Daniel Butum. All Rights Reserved.
2#pragma once
3
4#include "DlgObject.h"
5
6#include "DlgManager.h"
7#include "UObject/Object.h"
8
10{
11 // We must always set the outer to be something that exists at runtime
12#if WITH_EDITOR
13 if (UEdGraphNode* GraphNode = Cast<UEdGraphNode>(GetOuter()))
14 {
15 UDlgDialogue::GetDialogueEditorAccess()->SetNewOuterForObjectFromGraphNode(this, GraphNode);
16 }
17#endif
18
19 Super::PostInitProperties();
20}
21
22UWorld* UDlgObject::GetWorld() const
23{
24 if (HasAnyFlags(RF_ArchetypeObject | RF_ClassDefaultObject))
25 {
26 return nullptr;
27 }
28
29 // Get from outer
30 if (UObject* Outer = GetOuter())
31 {
32 if (UWorld* World = Outer->GetWorld())
33 {
34 return World;
35 }
36 }
37
38 // Last resort
40}
static UWorld * GetDialogueWorld()
UFUNCTION(BlueprintCallable, Category = "Dialogue|Persistence")
UWorld * GetWorld() const override
Definition DlgObject.cpp:22
void PostInitProperties() override
Definition DlgObject.cpp:9