UE4 Crash Please help

Hi,

I’m following a tutorial on C++ and have been following the code exactly, but when I get to a point in the course where I have to build my UE4 Editor with the project open will then crash and show the following message:

https://img-a.udemycdn.com/redactor/raw/q_and_a/2021-01-09_20-56-48-f100d02c6335212df164b5c82c14e4dd.png?CerTYtAPijAtYqTccCc39_T5VhEu29ilV5iMbEnIBOKvTomOlNMiAeDQq9QAD4PybNPpNbzzC1DH0w1RCnVmRXDZTYLSWFQFH64LQhbUfDKDBBB3rtaB_jHGud1PT3uFY9f-7V-md1BPAGLAQaz7L9SH5qDUJPlZ2lLuyfGsN9pBhr1mklnpKPhrLhA

I’ve followed all of the videos exactly with the same code. this has happened twice now; after the first time I thought it was a one-off but now after I’ve restarted the whole thing in a totally new project it’s happened again. I’m not sure what to do, so I welcome any suggestions. I’ve tried deleting Binaries, Intermediate and Saved folders then regenerating them, but the same crash report will pop up when loading the project. My code is down below for reference if it will help.

Collider.cpp1

https://img-a.udemycdn.com/redactor/raw/q_and_a/2021-01-09_21-11-34-5e0df72eecd134bae257c8b3fa9bbb05.png?9MbyysIR2VxV1I-1jnrlf8bRSUwUaXisyBKRhq12NaRGDngNKYHQFlXT-MnMF6FiV-hYaRf2YQJO9CftMZQizgaI_AehK5gZgB_jSyIhH3RxMx1vAifCISZelHSZLa_cn-GqhL7AUBjRGnWD72ClTTNBEgKuFtiXNkc4DxgdKAUIelMM_u5F2qlplYE

Collider.cpp2

https://img-a.udemycdn.com/redactor/raw/q_and_a/2021-01-09_21-11-34-bf9c3e9146e8c452b7b2dc3a613e1a22.png?zaZGIZbROHjvVhK8VBFQ03KqlYDIGcwMgF9zq2o6kJSC-zzHgidT6txU5ol1h0A7hJjpPgvRB5GQrD0gVxyRRc4RX4C9YUjKLAvQqUtRki6Y-QydnhPxPe8p7gSS3zQ6fpDWTchUtZjCJiP2NmskaF6A9y9EOAgMSn2O3Yye0V0uTgi4ZRB6iJPvUCI

Collider.h1

https://img-a.udemycdn.com/redactor/raw/q_and_a/2021-01-09_21-11-34-0f5649b5073b5e2e9df4222963aac410.png?s420nHM9EtDxtMK0Zczp6WKxrXeniGmz96Gue3wEjlJlv40m0L_PmQBMEWuavBmFVldmqZDNuchsrnbozJJ4VSFSTiG6p5CB9e23Fzi0R1yWdSDtS8GHfVxmYhLQPXugtEEY_PMBLX3xruak9RLggaExKPgRIyhJZrLrFfv_7TvVS5dROWjJj89QjUA

Collider.h2

https://img-a.udemycdn.com/redactor/raw/q_and_a/2021-01-09_21-11-34-7d0224503e2557d07d17a2d8d4cab540.png?Vc4qBvEtp4LRK34Z0biAAk8_-QTVQOPExtm-eF3ECCkyf2vxSAledRIF7DfIcema2ZR_9aeIUDQzaCKCozSvrBQJXkSGeJ6mZg3rUg8SUVMwuMwV88-EFc6KGCQtt3HOwGpWquNpp5kPLEWbIBfLS06qidoCXmzJzBeM51AZfw8kSM-RyNpdOd7FxJw

ColliderMovementComponent.cpp

https://img-a.udemycdn.com/redactor/raw/q_and_a/2021-01-09_21-11-34-b2bd64d1c5d798f9b37b46198af25129.png?uASSj7F7aXa-EBtgQfZ3sgTdVR-kBqgsLdIauOq8Pr1NWQ6gRY2flvsZxuHzAdNcK_M2jxvvx6jKGnLSPJTMlLN1XaF4_b-bOEGk3CsAqN2U-aHTSaKMx0OBniIp3NfZVZzNclEAgWf9XC4JrA3WkMzTqJ8NclGzvYUHEJD9FyCbMvYkchFjIQXJOdk

ColliderMovementComponent.h

https://img-a.udemycdn.com/redactor/raw/q_and_a/2021-01-09_21-11-34-2140b7a6456cbdbe7c10807e51470c88.png?88irmKrJr9sOAUP7GNFw6JZZ4-HElE9iUC1ZdmBualhDuPKewwdvTAGWlxFfTiuyzZLBxJRQ-fKdpsMLxgVnRicSueKqURlFrlS0klvMs_YC1ApjLNjtfd8gzAdwGPpXvnb4KHZRhrHeA6G_m02bDp7Vz7PGgjskwMA4xlsDlomvJXR86FSo-_rHxP0

Can still edit the individual .cpp and .h files by opening them from my folder, but crash message will just pop up if I try and reopen the UE4 project.

If I had to guess, the issue is related to the ACollider’s constructor, where you are using an FObjectFinder to set the mesh. You can try to update the constructor with an FObjectInitializer and see if it helps, but to be honest, I don’t recommend hard coding assets into actors. You have the editor for a reason, use it, instead of fighting it.

Copied from Class Constructor docs.



UMyObject::UMyObject(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer)
{
     // Constructor logic for UMyObject here...
}


You’re using an uninitialized pointer. You’ve written OurMovementComponent->Create… instead of OurMovementComponent = Create…