UE5 Crashing after adding socket code

image

I’ve attached a weapon socket to weapon_r. On play, Unreal crashes. When the gun attachment and set owner are removed, the crash is resolved. I don’t know where I’m going wrong

Gun is a nullptr, or worse is initialized with junk data since it has not actually been initialized with a value.

Which creates an access violation error, hence your crash. You need to spawn your gun and have your gun pointer reference it.

To put in a (hopefully) fun way… You are telling your gun pointer to stare into the Unreal Void, and it does not like being stared at (it’s shy, you know!).

I added a null check and you were correct, it is a nullptr. I’m just unsure how to fix this error

I found the error. I never actually set the gun

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

Privacy & Terms