Actors that are removed from the world have UnregisterAllComponents called twice. Removal can be caused by unloading a data layer that owns the actor.
In cases like exiting the application or destroying the actor, the Unregister call occurs after EndPlay, meaning that the actor is still registered during EndPlay. For actors being removed from the world, they are unregistered during EndPlay.
1. Create a first person template project
2. Override EndPlay and UnregisterAllComponents in the project character class
3. Add breakpoints to those functions
4. Add a runtime datalayer to the level and add a project character to it. This layer should be default activated.
5. Toggle the runtime layer using the data layer manager at runtime to unloaded.
6. Cook and run the project as Development Game
When the toggle happens, the project character will be removed from the world, and in doing so, will hit the breakpoints in the following order:
UnregisterAllComponents
EndPlay
UnregisterAllComponents
First, pre-EndPlay callstack:
AUDN14260200Character::UnregisterAllComponents(const bool) UDN14260200Character.cpp:59
ULevel::IncrementalUnregisterComponents(int) __ptr64 0x00007ff74d129ca1
UWorld::RemoveFromWorld(ULevel * __ptr64,bool,FNetLevelVisibilityTransactionId,ULevelStreaming * __ptr64) __ptr64 0x00007ff74de63b7d
ULevelStreaming::UpdateStreamingState(bool & __ptr64,bool & __ptr64) __ptr64 0x00007ff74d157e92
UWorld::UpdateLevelStreaming(void) __ptr64 0x00007ff74de79998
UGameViewportClient::Draw(FViewport * __ptr64,FCanvas * __ptr64) __ptr64 0x00007ff74cf0d7ff
FViewport::Draw(bool) __ptr64 0x00007ff74dc8fc73
UGameEngine::RedrawViewports(bool) __ptr64 0x00007ff74ce93cc8
UGameEngine::Tick(float,bool) __ptr64 0x00007ff74cea59be
FEngineLoop::Tick(void) __ptr64 0x00007ff74e504efa
GuardedMain(wchar_t const * __ptr64) 0x00007ff74e51d24c
LaunchWindowsStartup(HINSTANCE__ * _ptr64,HINSTANCE_ * __ptr64,char * __ptr64,int,wchar_t const * __ptr64) 0x00007ff74e51ff38
WinMain 0x00007ff74e5301c4
[Inlined] invoke_main() 0x00007ff7522b6daa
__scrt_common_main_seh() 0x00007ff7522b6d89
<unknown> 0x00007ffbe5eb257d
<unknown> 0x00007ffbe7daaf08
EndPlay callstack:
AUDN14260200Character::EndPlay(Type) UDN14260200Character.cpp:53
AActor::RouteEndPlay(EEndPlayReason::Type) __ptr64 0x00007ff74c56f778
UWorld::RemoveFromWorld(ULevel * __ptr64,bool,FNetLevelVisibilityTransactionId,ULevelStreaming * __ptr64) __ptr64 0x00007ff74de63cf8
ULevelStreaming::UpdateStreamingState(bool & __ptr64,bool & __ptr64) __ptr64 0x00007ff74d157e92
UWorld::UpdateLevelStreaming(void) __ptr64 0x00007ff74de79998
UGameViewportClient::Draw(FViewport * __ptr64,FCanvas * __ptr64) __ptr64 0x00007ff74cf0d7ff
FViewport::Draw(bool) __ptr64 0x00007ff74dc8fc73
UGameEngine::RedrawViewports(bool) __ptr64 0x00007ff74ce93cc8
UGameEngine::Tick(float,bool) __ptr64 0x00007ff74cea59be
FEngineLoop::Tick(void) __ptr64 0x00007ff74e504efa
GuardedMain(wchar_t const * __ptr64) 0x00007ff74e51d24c
LaunchWindowsStartup(HINSTANCE__ * _ptr64,HINSTANCE_ * __ptr64,char * __ptr64,int,wchar_t const * __ptr64) 0x00007ff74e51ff38
WinMain 0x00007ff74e5301c4
[Inlined] invoke_main() 0x00007ff7522b6daa
__scrt_common_main_seh() 0x00007ff7522b6d89
<unknown> 0x00007ffbe5eb257d
<unknown> 0x00007ffbe7daaf08
Post-EndPlay callstack:
AUDN14260200Character::UnregisterAllComponents(const bool) UDN14260200Character.cpp:59
ULevel::ClearLevelComponents(void) __ptr64 0x00007ff74d116417
UWorld::RemoveFromWorld(ULevel * __ptr64,bool,FNetLevelVisibilityTransactionId,ULevelStreaming * __ptr64) __ptr64 0x00007ff74de64127
ULevelStreaming::UpdateStreamingState(bool & __ptr64,bool & __ptr64) __ptr64 0x00007ff74d157e92
UWorld::UpdateLevelStreaming(void) __ptr64 0x00007ff74de79998
UGameViewportClient::Draw(FViewport * __ptr64,FCanvas * __ptr64) __ptr64 0x00007ff74cf0d7ff
FViewport::Draw(bool) __ptr64 0x00007ff74dc8fc73
UGameEngine::RedrawViewports(bool) __ptr64 0x00007ff74ce93cc8
UGameEngine::Tick(float,bool) __ptr64 0x00007ff74cea59be
FEngineLoop::Tick(void) __ptr64 0x00007ff74e504efa
GuardedMain(wchar_t const * __ptr64) 0x00007ff74e51d24c
LaunchWindowsStartup(HINSTANCE__ * _ptr64,HINSTANCE_ * __ptr64,char * __ptr64,int,wchar_t const * __ptr64) 0x00007ff74e51ff38
WinMain 0x00007ff74e5301c4
[Inlined] invoke_main() 0x00007ff7522b6daa
__scrt_common_main_seh() 0x00007ff7522b6d89
<unknown> 0x00007ffbe5eb257d
<unknown> 0x00007ffbe7daaf08
There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-229627 in the post.
1 |
Component | UE - World Creation - Worldbuilding Tools |
---|---|
Affects Versions | 5.6, 5.4.4 |
Created | Nov 5, 2024 |
---|---|
Updated | Nov 6, 2024 |