If the question was obscure or silly, sorry about that. I’m almost out of mind spending all day long continuously encountering similar errors unsolved, and this is one of them.
Whenever I try to compile and play my project on the editor, Unreal Engine gets crashed and shows this.
Unhandled Exception: EXCEPTION_ACCESS_VIOLATION reading address 0x00000000000002d0
UnrealEditor_Engine
UnrealEditor_F15Test!APlayerC::AddActorToArray() [C:\Users\Park\Documents\Unreal Projects\F15Test 5.1\Source\F15Test\Private\PlayerC.cpp:205]
UnrealEditor_F15Test!APlayerC::CManageActorsInRange() [C:\Users\Park\Documents\Unreal Projects\F15Test 5.1\Source\F15Test\Private\PlayerC.cpp:122]
UnrealEditor_CoreUObject
UnrealEditor_CoreUObject
UnrealEditor_CoreUObject
UnrealEditor_CoreUObject
UnrealEditor_CoreUObject
UnrealEditor_CoreUObject
UnrealEditor_CoreUObject
UnrealEditor_CoreUObject
UnrealEditor_CoreUObject
UnrealEditor_Engine
UnrealEditor_Engine
UnrealEditor_Engine
UnrealEditor_Engine
UnrealEditor_Engine
UnrealEditor_Engine
UnrealEditor_Engine
UnrealEditor_Core
UnrealEditor_Core
UnrealEditor_Core
UnrealEditor_Engine
UnrealEditor_Engine
UnrealEditor_Engine
UnrealEditor_Engine
UnrealEditor_UnrealEd
UnrealEditor_UnrealEd
UnrealEditor
UnrealEditor
UnrealEditor
UnrealEditor
UnrealEditor
UnrealEditor
kernel32
ntdll
As I searched on the internet, this EXCEPTION_ACCESS_VIOLATION error seems to occur in many other ways. This might include running the code without allocating memory to arrays or pointers, accessing wrong address due to variable initialization absence, and so on.
Since there are so many reasons, I first assumed this error comes from not giving default values(variable initialization absent). I didn’t do for most of the variables(or especially pointers and arrays).
This is part of my project’s header file.
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "ManageActors")
TArray<AActor*> GndAllyInRange;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "ManageActors")
TArray<AActor*> MissilesInRange;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "ManageActors")
TArray<AActor*> AirActorInCloseRange;
There are a bunch of properties,
UFUNCTION(BlueprintCallable)
void CManageActorsInRange();
UFUNCTION(BlueprintCallable)
void CUpdatePosition();
UFUNCTION(BlueprintCallable)
void AddActorToArray(TArray<AActor*> ActorInRange, AActor* OtherActor);
and some functions.
If necessary, what should I put in for each types’ initialization?(ex: 0.0f for floats)
also if you need some other codes or additional explanations, I’ll upload it ASAP.