Game crashes when trying to run Mover->SetShouldMove()

Whenever either Mover->SetShouldMove(true) or Mover->SetShouldMove(false) runs, the game crashes. I’m trying to make the overlapped trigger component move an actor with the mover component, instead of an actor with the trigger component, as done in the lecture. The compiler isn’t giving any error messages. What did I do wrong?




Mover is very likely nullptr. Are you calling SetMover on the trigger component?

The input of SetMover is a Mover component, which is setup in blueprints. The function is set public, so I thought that TriggerComponent.h would also get the SetMover function. Does the SetMover input not transfer to TriggerComponent.h/cpp when SetMover is public?

I highly suggest you don’t think it terms of files as that is orthogonal.

void Func(UMover* Mover)
{
    Mover->MemberFunc(); // wouldn't compile if MemberFunc isn't public
}

This function could even be defined in Mover.h (if you make it inline) and it would wouldn’t change about the ability to call the function or not. There’s no “transfering”


With all of that said I don’t think you understood what I was asking.

  1. Are you calling SetMover on your trigger component in blueprint?
  2. Does the actor have a mover component?

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

Privacy & Terms