ANavLinkProxy::ANavLinkProxy(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer) { USceneComponent* SceneComponent = CreateDefaultSubobject<USceneComponent>(TEXT("PositionComponent")); RootComponent = SceneComponent; bHidden = true; #if WITH_EDITORONLY_DATA EdRenderComp = CreateDefaultSubobject<UNavLinkRenderingComponent>(TEXT("EdRenderComp")); EdRenderComp->PostPhysicsComponentTick.bCanEverTick = false; EdRenderComp->SetupAttachment(RootComponent); #endif // WITH_EDITORONLY_DATA #if WITH_EDITOR SpriteComponent = CreateEditorOnlyDefaultSubobject<UBillboardComponent>(TEXT("Sprite")); if (!IsRunningCommandlet() && (SpriteComponent != NULL)) { struct FConstructorStatics { ConstructorHelpers::FObjectFinderOptional<UTexture2D> SpriteTexture; FName ID_Decals; FText NAME_Decals; FConstructorStatics() : SpriteTexture(TEXT("/Engine/EditorResources/AI/S_NavLink")) , ID_Decals(TEXT("Navigation")) , NAME_Decals(NSLOCTEXT("SpriteCategory", "Navigation", "Navigation")) { } }; static FConstructorStatics ConstructorStatics; SpriteComponent->Sprite = ConstructorStatics.SpriteTexture.Get(); SpriteComponent->RelativeScale3D = FVector(0.5f, 0.5f, 0.5f); SpriteComponent->bHiddenInGame = true; SpriteComponent->bVisible = true; SpriteComponent->SpriteInfo.Category = ConstructorStatics.ID_Decals; SpriteComponent->SpriteInfo.DisplayName = ConstructorStatics.NAME_Decals; SpriteComponent->SetupAttachment(RootComponent); SpriteComponent->SetAbsolute(false, false, true); SpriteComponent->bIsScreenSizeScaled = true; } #endif SmartLinkComp = CreateDefaultSubobject<UNavLinkCustomComponent>(TEXT("SmartLinkComp")); SmartLinkComp->SetNavigationRelevancy(false); SmartLinkComp->SetMoveReachedLink(this, &ANavLinkProxy::NotifySmartLinkReached); bSmartLinkIsRelevant = false; PointLinks.Add(FNavigationLink()); SetActorEnableCollision(false); bCanBeDamaged = false; }
ANavLinkProxy::ANavLinkProxy(const class FPostConstructInitializeProperties& PCIP) : Super(PCIP) { TSubobjectPtr<USceneComponent> SceneComponent = PCIP.CreateDefaultSubobject<USceneComponent>(this, TEXT("PositionComponent")); RootComponent = SceneComponent; #if WITH_EDITORONLY_DATA EdRenderComp = PCIP.CreateDefaultSubobject<UNavLinkRenderingComponent>(this, TEXT("EdRenderComp")); EdRenderComp->PostPhysicsComponentTick.bCanEverTick = false; EdRenderComp->AttachParent = RootComponent; #endif // WITH_EDITORONLY_DATA #if WITH_EDITOR SpriteComponent = PCIP.CreateEditorOnlyDefaultSubobject<UBillboardComponent>(this, TEXT("Sprite")); if (!IsRunningCommandlet() && (SpriteComponent != NULL)) { static ConstructorHelpers::FObjectFinderOptional<UTexture2D> SpriteTexture(TEXT("/Engine/EditorResources/AI/S_NavLink")); SpriteComponent->Sprite = SpriteTexture.Get(); SpriteComponent->bHiddenInGame = true; SpriteComponent->bVisible = true; SpriteComponent->AttachParent = RootComponent; SpriteComponent->SetAbsolute(false, false, true); } #endif SmartLinkComp = PCIP.CreateDefaultSubobject<USmartNavLinkComponent>(this, TEXT("SmartLinkComp")); SmartLinkComp->SetNavigationRelevancy(false); SmartLinkComp->SetMoveReachedLink(this, &ANavLinkProxy::NotifySmartLinkReached); bSmartLinkIsRelevant = false; PointLinks.Add(FNavigationLink()); SetActorEnableCollision(false); bCanBeDamaged = false; }