i am new to UE4 and i am stuck at a rather silly problem at the moment. My Editor keeps crashing at 71% when i add some really simple code. If I delete the code the Editor starts as normal.
Because of the simplicity of my code i cant really understand why this is happening and i hope that someone can provide some answers.
Inside a for-loop i am calling my function ‘PrintFloatToScreen’ like this:
PrintFloatToScreen("Some Array Filled With Floats");
Basically i just want to print the values of the array on my screen. Furthermore i want to use this function inside a blueprint.
I hope someone can help me figure out this problem.
Note:
I have the same problem implementing an if-else structure. Again: The code is really simple though it is crashing my editor. I get the feeling that there might be a far bigger problem with my coding that i dont understand yet. I am not completly new to c++ programming and i am surely able to implement some code outside UE4. Somehow i am barely able to implement anything in UE4.
Hey,
Thanks for your reply. I think it is the easiest if i show you my code and you can look at it yourself.
It is quite possible that GEngine is still null at this moment, because the engine is just starting up.
This would also explain why my code works once the engine is started.
If this is the root of my problem:
How do i prevent the engine from executing this code during startup or how do i make this code not crash?
Why does the engine execute this code during startup in the first place?
ImportBuildings.h:
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "Landscape.h"
#include <Engine.h>
#include <fstream>
#include <iostream>
#include <cmath>
#include "ProceduralMeshComponent.h" //Do need this later on to generate meshes during runtime
#include "ImportBuildings.generated.h"
UCLASS()
class MYPROJECT_API AImportBuildings : public AActor
{
GENERATED_BODY()
public:
AImportBuildings();
virtual void Tick(float DeltaTime) override;
virtual void BeginPlay() override;
UPROPERTY(BlueprintReadWrite)
TArray<float> BuildingConturPoints;
private:
//Functions:
UFUNCTION(Category = "Custom Functions", BlueprintCallable)
TArray<float> GetPointCoordinates();
UFUNCTION(Category = "Custom Functions", BlueprintCallable)
void PrintFloatToScreen(float Output);
//Variables:
TArray<double> AllPoints;
};
Note:
To shorten my answer I deleted alot of other stuff in that code that would happen after the long string is split and converted into numbers. Therefore this code is simplyfied by alot, which further represents why i think that my problem is really basic and that my c++ coding is not the root cause, but my lacking understanding of UE4.
I would need all the places where you call that “PrintFloatToScreen” method !
but that’s strange that the engine try to call it, once again, put a break point on it and check by yourself, i can’t do that for you
Also i see you have those includes, i would recommand you to only use UE ones ( probably not the problem here though )