UE crashes the moment I open the project

Heyaa, I’m on the Building Escape part where we setup the actor rotation relatively, but when writing my code i wanted to declare an FRotator to store the result of GetOwner()->GetActorRotation();
because we used it multiple times in the code, anyways when i setup a member variable in the header file i forgot to include the “GameFramework/Actor.h” and now Unreal wouldnt even open the project and it insta crashes even though i fixed the code issues

Old/New source codes + CrashReport: BuildingEscape - Google Drive

<3

UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
class BUILDINGESCAPE_API UDoorOpen : public UActorComponent
{
    FRotator ActorRotation = GetOwner()->GetActorRotation();
};

That there is an issue as you are dereferencing what GetOwner returns but the owner isn’t set yet. The constructor is run before it’s attached to anything. You can’t set this here.

This isn’t an optimisation, this is actually making things slightly worse as all this does is make the class slightly larger.

1 Like

Got it, makes sense thanks a lot <333 i remade a simpler version of the project since it wouldnt open even after rebuilding the project files but thats okay :ok_hand:t2:

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms