Files
UnrealEngineUWP/Engine/Source/Runtime/NavigationSystem/Public/NavSystemConfigOverride.h
mieszko zielinski 47ba3c336d Changed when NavigationSystemConfigOverride initiates nav system creation at runtime
This change is needed in order to ensure that we create navigation system via the nav config override while outside of async-loading logic. Otherwise we severly limit navigation system instances' capabilities of loading assets (like NavArea BP classes).

#rb Stephen.Holmes
[at]Yoan.StAmant, [at]Stephen.Holmes, [at]Mikko.Mononen


#ROBOMERGE-SOURCE: CL 9149252 via CL 9149255 via CL 9149276
#ROBOMERGE-BOT: (v443-9013191)

[CL 9149282 by mieszko zielinski in Main branch]
2019-09-26 12:27:07 -04:00

83 lines
2.6 KiB
C++

// Copyright 1998-2019 Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "UObject/ObjectMacros.h"
#include "GameFramework/Actor.h"
#include "AI/NavigationSystemBase.h"
#include "NavSystemConfigOverride.generated.h"
class UNavigationSystemConfig;
UENUM()
enum class ENavSystemOverridePolicy : uint8
{
Override, // the pre-exising nav system instance will be destroyed.
Append, // config information will be added to pre-existing nav system instance
Skip // if there's already a NavigationSystem in the world then the overriding config will be ignored
};
UCLASS(hidecategories = (Input, Rendering, Actor, LOD, Cooking))
class NAVIGATIONSYSTEM_API ANavSystemConfigOverride : public AActor
{
GENERATED_BODY()
#if WITH_EDITORONLY_DATA
private:
UPROPERTY()
class UBillboardComponent* SpriteComponent;
#endif // WITH_EDITORONLY_DATA
protected:
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Navigation, Instanced, meta = (NoResetToDefault))
UNavigationSystemConfig* NavigationSystemConfig;
/** If there's already a NavigationSystem instance in the world how should this nav override behave */
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Navigation)
ENavSystemOverridePolicy OverridePolicy;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Navigation, AdvancedDisplay)
uint8 bLoadOnClient : 1;
public:
ANavSystemConfigOverride(const FObjectInitializer& ObjectInitializer = FObjectInitializer::Get());
//~ Begin UObject Interface
virtual void PostLoad() override;
virtual void PostInitProperties() override;
#if WITH_EDITOR
virtual void PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent) override;
#endif // WITH_EDITOR
//~ End UObject Interface
//~ Begin AActor Interface
virtual void BeginPlay() override;
//~ End AActor Interface
#if WITH_EDITOR
/** made an explicit function since rebuilding navigation system can be expensive */
UFUNCTION(Category = Navigation, meta = (CallInEditor = "true"))
void ApplyChanges();
//virtual void CheckForErrors() override;
#endif
protected:
/** Creates a new navigation system and plugs it into the world. If there's a
* nav system instance already in place it gets destroyed. */
virtual void OverrideNavSystem();
/** Appends non-conflicting information (like supported agents) to a pre-existing
* nav system instance */
virtual void AppendToNavSystem(UNavigationSystemBase& PrevNavSys);
#if WITH_EDITOR
/** Called only in the editor mode*/
void InitializeForWorld(UNavigationSystemBase* NewNavSys, UWorld* World, const FNavigationSystemRunMode RunMode);
#endif // WITH_EDITOR
void ApplyConfig();
};