UE_Log doesn't work

Hi all,

Here is DrawPreviewInfrastructure.h :

// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "DrawPreviewInfrastructure.generated.h"

class CITYBUILDER_API ADrawPreviewInfrastructure : public AActor

    // Sets default values for this actor's properties

    // Called when the game starts or when spawned
    virtual void BeginPlay() override;

    // Called every frame
    virtual void Tick(float DeltaTime) override;

    UFUNCTION(BlueprintCallable, Category = "Preview")
    bool CollisionPointPolygone(TArray<FVector> Polygone, int32 nbp, FVector Point);


DrawPreviewInfrastructure.cpp :

 #include "CityBuilder.h"
#include "DrawPreviewInfrastructure.h"
#include "Kismet/KismetMathLibrary.h"

// Sets default values
     // Set this actor to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
    PrimaryActorTick.bCanEverTick = false;


// Called when the game starts or when spawned
void ADrawPreviewInfrastructure::BeginPlay()



// Called every frame
void ADrawPreviewInfrastructure::Tick(float DeltaTime)


 bool ADrawPreviewInfrastructure::CollisionPointPolygone(TArray<FVector> Polygone, int32 nbp, FVector Point){

     FVector A, B, D, T;
     float d;

     UE_LOG(LogTemp, Warning, TEXT("Your message"));

    for (int32 i = 0; i<nbp; i++)

        UE_LOG(LogTemp, Warning, TEXT("test"));

        A = Polygone*;
        if (i == nbp - 1)  // si c'est le dernier point, on relie au premier
            B = Polygone[0];
        else           // sinon on relie au suivant.
            B = Polygone[i + 1];

        D.X = B.X - A.X;
        D.Y = B.Y - A.Y;
        T.X = Point.X - A.X;
        T.Y = Point.Y - A.Y;
        d = D.X*T.Y - D.Y*T.X;
        if (d<0)
            return false;  // un point à droite et on arrête tout.
    return true;  // si on sort du for, c'est qu'aucun point n'est à gauche, donc c'est bon.

In DrawPreviewInfrastructure_BP blueprint, which inherits from DrawPreviewInfrastructure, i call CollisionPointPolygone() function, but the UE_LOG message is not displayed in the output log window. I launch the game in standalone game mode. Why so please ?

If you launch the game in standlone it runs as a different process and is not connected to the editor instance, I belive that’s why your standalone logs are not displayed in your editor output log if that’s the case. So either play via PIE (Play in editor) or add -log to the launch options of the standalone instance to open a seperate output log.

Thank you so much mate

the issue playing the game in PIE is that UE4 has issues with garbage collector and the memory space increases constantly until i have to restart the engine. Now im trying to log debugs strings while in standalone mode, but the command line “- debug” doesnt work.

You could try adding ‘-game’ in the command line when running through Visual Studio. This runs the game without the editor opening first and should print UE_LOG to the Output window in VS…

thanks mate