Component function changes, Blueprint crash

Windows 10 - Binary Version - 4.10.3

I am using the 3rd person template for my project. On my C++ character class, after some time I replaced the Camera Boom with my custom spring arm component class(I just swapped the class names in code) and overrode the standard character movement component.

Since I got some strange behaviour from both on initialisation functions (InitializeComponent did not work for the spring arm, PostInitProperties not for the movement comp) I overrode BeginPlay for both as an init method. Now both initialised properly, but when I tried to open my character blueprint, the editor crashed.

I found out that this is caused by the BeginPlay override of the spring component class, and replaced it with PostInitProperties, which lets me load the blueprint again.

Hello queelaga-

I’m not sure I understand what your question is. You mentioned a crash but then it sounds as though you were able to edit the code to fix the crash. Can you elaborate on what exactly you’re reporting and what you need help with?

Cheers

Doug Wilson

I am able to work around it, but the problem that I can’t override the BeginPlay function(without crashing the editor on opening the player BP) remains.

Can I get more information about how you’re overriding BeginPlay? If you could also post the callstack and log files from the crash, we can use that to hopefully find where the crash is occurring.

I think I figured out where the crash is coming from:
For some reason, when I open the player character blueprint (or when I stop the game with the blueprint open in editor) the engine calls the springsarms TickComponent functions(several hundred times).
In the tick function, I call two functions that dereference pointers that are supposedly set in the BeginPlay function, which of course does not get called when the game is not running, so nullptr gets called → crash.
I added some checks for the pointers with logs (which is how I figured that out), so it’s not an immediate problem any more, but I find this behaviour very odd still.
Also, I couldn’t reproduce this with the movement component, so I’m not sure what the cause is.

edit: this behaviour only applies as long as BeginPlay is being overridden.

Can you post the callstack and log files from the crash to provide additional information? Also, if you can post the code you’re using when you override BeginPlay it will help me setup a recreation of the issue locally.

Hi queelaga,

We have not heard back from you in a few days, so we are marking this post as Resolved for tracking purposes. If you are still experiencing the issue you reported, please respond to this message with additional information and we will offer further assistance.

Thank you.