UOBject lifetimes are governed by a garbage collection system. "Destroyed" doesn't mean the c++ object goes away, it is instead deleted when a garbage collection pass is ran
Functions called in the destructor are not being called properly. Setting a call to AddOnScreenDebugMessage is displayed at the start of PIE rather than when the actor's destroy is called.
1. Open UE4Editor (any project)
2. Add code to project based on Actor (MyActor)
3. Add destructor fuction to MyActor.h (~MyActor(); )
4. Add destrcutor implementation to MyActor.cpp
AMyActor::~AMyActor() { if (GEngine) { GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Yellow, TEXT("Actor destroyed")); } UE_LOG(LogTemp, Log, TEXT("Actor has been deleted")); }
5. Compile
6. create blueprint based on class
7. Wire keypress T event to a Destroy Actor call
8. Set Default Receive Input to Player 0
9. Play in Editor and press the T key
Result:
"Actor Destroyed" is displayed at the beginning of PIE rather than when the call to Destroy Actor is made. Also output log does not display message until after PIE is exited
Expected:
Actor exists until T is pressed. When Destroy Actor BP node is triggered it calls the code based destructor function to execute function calls inside at that time.
error message when install in U.E 5.3 - IS-IN-FCO2-82
I am not able to find world outliner how to enable it?
How can i modify the param name in EQS node
Undefined sysmbol: typeinfo for AActor when cross-compile linux dedicated server on windows
Delay nodes occasionally don't fire the "Completed" output in a nativized build
How to achieve HLSL Multiple Render Target in Material blueprints?
Head over to the existing Questions & Answers thread and let us know what's up.
0 |
Component | UE - Gameplay - Blueprint |
---|---|
Affects Versions | 4.8.1 |
Target Fix | 4.9 |
Created | Jul 13, 2015 |
---|---|
Resolved | Jul 13, 2015 |
Updated | Apr 27, 2018 |