Hello, my editor crashes whenever I try to access any variable in a public function on a UActorComponent. I am making the call to that component’s public function inside the tick function of another UActorComponent. This is strange because it is crashing even when I try to simply access a member variable. Below are screenshots of the code, and the crash report:
The crash is happening in the parent function. hitboxController is null.
This happens because sometimes you can actually call functions on null objects in C++. It sounds weird but kinda makes sense when explained: if the function isn’t virtual then it’s known at compile time what code to run so there’s nothing to crash at until you actually try to access its member variables.
That was exactly the issue. I was initializing the components inside the constructor. Moving the initializations to the “BeginPlay” method fixed this. Thanks you!
Note:
it is strange though I was initializing a USkeletalMeshComponent in the same way, but there was no issue calling the methods of that object.