Dear Friends at Epic,
I spawn and delete a lot of Characters during runtime in my in-game editor.
I spawn these characters with their Blueprint.
During editor mode, I set custom gravity factor to 0 for all characters so they can be moved around to any height above the landscape
When Game mode starts, the gravity factor is restored to 1 and the characters fall from their editor location to the landscape.
#The Context
I run my game only from independent instance, the editor is never loaded.
I am iterating over all Characters to change their gravity during game time using ObjectIterator
Here is my iterator code
for ( TObjectIterator Itr; Itr; ++Itr )
{
//Evolver is Valid?
if( ! Itr->IsValidLowLevel()) continue;
if(Itr->IsPendingKill()) continue;
//~~~~~~~~~~~~~~~~~~~~~~~
Itr->SERVER_SetGameMode(EnteringGameMode);
}
It is only during this process of iterating over actors and setting their Game Mode to active (does some AI related things and changes their gravity to 1) that the crash occurs.
#When Crash Does Not Occur
The crash only occurs if some characters have been recently spawned / deleted / and new characters spawned,
Then when these characters begin falling when gravity is restored, or even if I take out all my custom gravity code, but the characters are moving around because they are jumping off each other,
when they first begin to move, that is when the crash occurs
#My Set Gravity Function
Here is how I set gravity during starting Game Mode, this code is only related because it causes the characters to start to move.
void AVictoryPlayerCharacterBase::SERVER_SetGravityScale_Implementation(float TheGravityScale)
{
//Rep
RepGravityScale = TheGravityScale;
OnRep_SetGravityScale();
}
void AVictoryPlayerCharacterBase::OnRep_SetGravityScale()
{
if(!CharacterMovement) return;
if(!CharacterMovement->IsValidLowLevel()) return;
if(CharacterMovement->IsPendingKill()) return;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CharacterMovement->GravityScale = RepGravityScale;
}
#The Crash
I can create as many actors as I want and then delete them and all is well
Then when I go into game mode, all is well.
But if I create a lot of actors, delete a lot of actors, and then create more very quickly,
Sometimes, when a character begins to move, they instantly disappear permanently,
other times I get this crash:
VictorySkelBP_C_22 MovedComponent None not initialized deleteme 0
Address = 0xfd219e5d (filename not found) [in C:\Windows\system32\KERNELBASE.dll]
Address = 0xe18f1a1c (filename not found) [in C:\Program Files\Rocket\Engine\Binaries\Win64\RocketEditor-Core.dll]
Address = 0xe17fc8b2 (filename not found) [in C:\Program Files\Rocket\Engine\Binaries\Win64\RocketEditor-Core.dll]
Address = 0xdfa2cb40 (filename not found) [in C:\Program Files\Rocket\Engine\Binaries\Win64\RocketEditor-Engine.dll]
Address = 0xdf9a3a6e (filename not found) [in C:\Program Files\Rocket\Engine\Binaries\Win64\RocketEditor-Engine.dll]
Address = 0xdf9af5a5 (filename not found) [in C:\Program Files\Rocket\Engine\Binaries\Win64\RocketEditor-Engine.dll]
Address = 0xdf008c3f (filename not found) [in C:\Program Files\Rocket\Engine\Binaries\Win64\RocketEditor-Engine.dll]
Address = 0xdf0155d4 (filename not found) [in C:\Program Files\Rocket\Engine\Binaries\Win64\RocketEditor-Engine.dll]
Address = 0xdf007a0b (filename not found) [in C:\Program Files\Rocket\Engine\Binaries\Win64\RocketEditor-Engine.dll]
Address = 0xdf018746 (filename not found) [in C:\Program Files\Rocket\Engine\Binaries\Win64\RocketEditor-Engine.dll]
Address = 0xdef55f67 (filename not found) [in C:\Program Files\Rocket\Engine\Binaries\Win64\RocketEditor-Engine.dll]
Address = 0xdef5ebd6 (filename not found) [in C:\Program Files\Rocket\Engine\Binaries\Win64\RocketEditor-Engine.dll]
Address = 0xdfc3d8f6 (filename not found) [in C:\Program Files\Rocket\Engine\Binaries\Win64\RocketEditor-Engine.dll]
Address = 0xdfc5586f (filename not found) [in C:\Program Files\Rocket\Engine\Binaries\Win64\RocketEditor-Engine.dll]
Address = 0xe1729856 (filename not found) [in C:\Program Files\Rocket\Engine\Binaries\Win64\RocketEditor-Core.dll]
Address = 0xe172999d (filename not found) [in C:\Program Files\Rocket\Engine\Binaries\Win64\RocketEditor-Core.dll]
Address = 0xe173a93f (filename not found) [in C:\Program Files\Rocket\Engine\Binaries\Win64\RocketEditor-Core.dll]
Address = 0xdfc8b58b (filename not found) [in C:\Program Files\Rocket\Engine\Binaries\Win64\RocketEditor-Engine.dll]
Address = 0xdfc8fbaf (filename not found) [in C:\Program Files\Rocket\Engine\Binaries\Win64\RocketEditor-Engine.dll]
Address = 0xdf9464e6 (filename not found) [in C:\Program Files\Rocket\Engine\Binaries\Win64\RocketEditor-Engine.dll]
Address = 0xdf94cbd4 (filename not found) [in C:\Program Files\Rocket\Engine\Binaries\Win64\RocketEditor-Engine.dll]
Address = 0xdf7a818a (filename not found) [in C:\Program Files\Rocket\Engine\Binaries\Win64\RocketEditor-Engine.dll]
Address = 0x3fd38edc (filename not found) [in C:\Program Files\Rocket\Engine\Binaries\Win64\RocketEditor.exe]
Address = 0x3fd2e8dc (filename not found) [in C:\Program Files\Rocket\Engine\Binaries\Win64\RocketEditor.exe]
Address = 0x3fd2e94a (filename not found) [in C:\Program Files\Rocket\Engine\Binaries\Win64\RocketEditor.exe]
Address = 0x3fd3a73b (filename not found) [in C:\Program Files\Rocket\Engine\Binaries\Win64\RocketEditor.exe]
Address = 0x3fd3b3ef (filename not found) [in C:\Program Files\Rocket\Engine\Binaries\Win64\RocketEditor.exe]
Address = 0x76fd652d (filename not found) [in C:\Windows\system32\kernel32.dll]
Address = 0x7720c521 (filename not found) [in C:\Windows\SYSTEM32\ntdll.dll]
Address = 0x7720c521 (filename not found) [in C:\Windows\SYSTEM32\ntdll.dll]
#What Does This Crash Mean?
What is this crash saying?
How can I protect against it when creating and deleting actors frequently?
This is one of the only crashes I’ve ever gotten which does not point to a place in my source code, who is reporting this crash?
Is it a movementcomponent, is it the engine itself?
The crash is referring to the 23rd instance of the creature I am creating and destroying VictorySkelBP_C_22, who is observing this inconsistency and reporting it?
#IsValidLowLevel() and IsPendingKill()
When I iterate over all actors to activate their gravity when entering game mode,
I do check:
if( ! Itr->IsValidLowLevel()) continue;
if( Itr->IsPendingKill()) continue;
#Thanks!
Thanks!
Rama