I have an animated Skeletal mesh in level sequence, it doesn’t play and game crashes after 30 seconds giving this error. Is the game adding my skeletal mesh into Garbage collection for some reason? read many articles and spent my whole yesterday but also don’t really know about C++ if that’s got the only solution. Any solution please regarding this error at least?
I’m surprised how no one knows or at least don’t know a solution. No one really got to this error?!
Can you describe your project a little more? What is in your project, what have you added, what plugins do you use, where there errors when packaging?
If you don’t want a variable to get garbage collected you need to make sure it has the UPROPERTY() macro above it in it’s definition in the header file.
for example
UPROPERTY(BlueprintReadWrite,EditAnywhere)
ACharacter* referenceCharacter;
This will not be GCed
I have three level sequences, in two of them animated a skeletal mesh using FKControlRig of the Skeletal mesh. They play in editor but not in packaged game, or at least the one I named GCAppear triggering to play in game before game crashes
This is my packaging settings including the 3 Level Sequences in “additional asset directories”.
My Garbage Collection settings:
I’m playing the sequences through Level BP:
No Error or Warning in Log while packaging, I even duplicated my map level, reassigned the actors in level sequences and packaged but still it happens. I start the game, hit start in main menu and either doing nothing or triggering the level sequence “GCAppear” to play by trigger box which doesn’t play, after I believe 30 seconds the game crashes giving the error above. Possible issues are that I had a few other copied levels and auto saved levels referencing the level sequences which I deleted them all and now left with main menu and my game level. I’ve named the level sequences GC… to shorten Girl creature as an enemy which is not a character BP or anything but a simple skeletal mesh. is the engine somehow mistaking GC with like GC from garbage collection?!! that can’t be a thing
Yes I believe the game engine simply adds the skeletal mesh of mine to garbage collection which I don’t know why it’d do that but I unfortunately don’t know how to work with C++. So I’ll be thankful if you guide me through achieving that. I actually selected my skeletal mesh and hit Edit in C++ and read the statement with UPROPERTY and content inside the bracket but not sure what to change at least. here’s an overview:
I would refrain from editing the files directly. It’s the first time I’ve ever seen a skeletal mesh be GC’ed.
Could It be the lack of control rig that might trigger this?
If anything then I would probably do a new character class that inherits from ACharacter and maybe override the skeletalmesh variable…better not touch the engine directly or you could cause a lot of unexpected problems.
Looking back at the Crash information it mentions “check log for details”.
What does the log say about the crash cause? (You will probably have a log folder with the file in your packaged project)
Oh yes you’re right, so the game log inside folder “Crashes” is giving 3 warnings at the end of the log but I couldn’t find a solution or at least couldn’t understand them well:
Could it be that you are missing a player start spawn point in your one of your levels?
The first line in the log mentions that it’s failing in finding a player start.
Then your get all actors of class (probably looking for “BenyAnim”) fails because the actor doesn’t spawn in the scene… This in tandem may lead to the GC of the rig that maybe linked to the missing character
(it probably exists in the scene for a while unlinked and with time just get collected)
I have my character in my game level in the world with possess 0 to start the game from. I have also only one game mode and assigned main menu level and the game level to this game mode. in main menu level no player gets spawned. Oh I got one of these assigned wrong?!
The log says the error originates in /Game/_MyStuff/Levels/Make_Her_Laugh_1
Is this the menu where you do not spawn a character then?
No that’s my game level. I deleted the player character and placed a player start, packaged but still get that first sentence in game log. is there a way to debug a packaged game? to see if all actors are in the world, not getting collected by GC, player being spawned correctly and so on. because as you said, the control rig or rig animation of the skeletal mesh might be the issue and so GC collects it. Over all thank you so much for the help my friend! I had tons of hard time downloading 3d models from websites, combining and rigging the enemy 3d model. might as well be still the issue like Engine not rendering it properly in packaging process
Have you tested if this occurs in the “Standalone Game” option? Does it crash there? (it does load up a full instance of the game separate from the editor and PIE)
Do you have “Editor symbols for debugging” installed with the engine. This might give you better insight once it crashes (you should get a stack trace)
They take up a lot of space but debugging is easier
It’s not crashing in Standalone Game. Didn’t have Editor symbols for debugging installed but now I’m installing. would take a while so I will work it out from there tomorrow. Have a nice day!
Hello @3dRaven !
I watched this video:
following the video guide I could be able to run the game in visual studio, debugging and the crashed happened, Visual Studio is telling me it’s because of this line of code
What should I change however?!
Are you using on the fly cooking when packaging the project?
Try hovering over Show Call Stack to get more detailed information.
Seems like it’s crashing during initial setup creating it’s main loop. Can you step over this error (the green arrow).
Sometimes you will get false positives with ensure functions that aren’t really errors.
Check the call stack and step over the error and see it the program can get any further.
The last exception will probably be closest to the actual thing causing the problem.
Which version of unreal are you on? 5.0.0 - 5,0.3?
I’m not sure what on the fly cooking is but I remember once accidentally hitting cook project before. before hitting build all. the call stack is directs to this line:
hitting the green arrow it loaded up the game for a second which was running in background (still!). hitting it for the second time it tried to load but the game crashed. I’m using 5.0.3. You’re definitely right I think I gotta try maybe 5.0.0
In packaging config you can also select the “Build Configuraton”
See if you change it from “Shipping” to “Debug Game” and see if you get better information during the crash (it should still have the full debug info when it stops working)
Also try ticking “Full Rebuild” (if an old cook file is corrupting the game it will be rebuilt)
And be sure to uncheck cooking on the fly if enabled (bottom part of picture)
Cooking on the fly is off, also noticed it’s not possible to install 5.0.0 if already have the 5.0.3. Following the video guide I packaged using “debug game” configuration and full rebuild I have checked. I’ll do the process again which is including debug files in package settings too, loading the debug version of the packaged game in Visual Studio. might get better details this time
should I probably try changing some packaging settings? because I see no error in the log and searched up for solutions but still seem to be getting the same log result which goes from start to finish which is the crash:
// exe_common.inl
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// The implementation of the common executable entry point code. There are four
// executable entry points defined by the CRT, one for each of the user-definable
// entry points:
//
// * mainCRTStartup => main
// * wmainCRTStartup => wmain
// * WinMainCRTStartup => WinMain
// * wWinMainCRTStartup => wWinMain
//
// These functions all behave the same, except for which user-definable main
// function they call and whether they accumulate and pass narrow or wide string
// arguments. This file contains the common code shared by all four of those
// entry points.
//
// The actual entry points are defined in four .cpp files alongside this .inl
// file. At most one of these .cpp files will be linked into the resulting
// executable, so we can treat this .inl file as if its contents are only linked
// into the executable once as well.
//
#include <vcstartup_internal.h>
#include <vcruntime_internal.h>
#include <locale.h>
#include <math.h>
#include <new.h>
#include <process.h>
#include <rtcapi.h>
#include <stdio.h>
#include <stdlib.h>
//-±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±+
//
// Common main()/WinMain() implementation
//
//-±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±+
struct __scrt_main_policy
{
static void set_app_type() { _set_app_type(_crt_console_app); }
};
struct __scrt_winmain_policy
{
static void set_app_type() { _set_app_type(_crt_gui_app); }
};
struct __scrt_enclavemain_policy
{
static void set_app_type() { }
};
struct __scrt_file_policy
{
static void set_fmode() { _set_fmode(_get_startup_file_mode()); }
static void set_commode() { _commode = _get_startup_commit_mode(); }
};
struct __scrt_nofile_policy
{
static void set_fmode() { }
static void set_commode() { }
};
#if defined _SCRT_STARTUP_MAIN
using main_policy = __scrt_main_policy;
using file_policy = __scrt_file_policy;
using argv_policy = __scrt_narrow_argv_policy;
using environment_policy = __scrt_narrow_environment_policy;
static int __cdecl invoke_main()
{
return main(__argc, __argv, _get_initial_narrow_environment());
}
#elif defined _SCRT_STARTUP_WMAIN
using main_policy = __scrt_main_policy;
using file_policy = __scrt_file_policy;
using argv_policy = __scrt_wide_argv_policy;
using environment_policy = __scrt_wide_environment_policy;
static int __cdecl invoke_main()
{
return wmain(__argc, __wargv, _get_initial_wide_environment());
}
#elif defined _SCRT_STARTUP_WINMAIN
using main_policy = __scrt_winmain_policy;
using file_policy = __scrt_file_policy;
using argv_policy = __scrt_narrow_argv_policy;
using environment_policy = __scrt_narrow_environment_policy;
static int __cdecl invoke_main()
{
return WinMain(
reinterpret_cast<HINSTANCE>(&__ImageBase),
nullptr,
_get_narrow_winmain_command_line(),
__scrt_get_show_window_mode());
}
#elif defined _SCRT_STARTUP_WWINMAIN
using main_policy = __scrt_winmain_policy;
using file_policy = __scrt_file_policy;
using argv_policy = __scrt_wide_argv_policy;
using environment_policy = __scrt_wide_environment_policy;
static int __cdecl invoke_main()
{
return wWinMain(
reinterpret_cast<HINSTANCE>(&__ImageBase),
nullptr,
_get_wide_winmain_command_line(),
__scrt_get_show_window_mode());
}
#elif defined _SCRT_STARTUP_ENCLAVE || defined _SCRT_STARTUP_WENCLAVE
using main_policy = __scrt_enclavemain_policy;
using file_policy = __scrt_nofile_policy;
using argv_policy = __scrt_no_argv_policy;
using environment_policy = __scrt_no_environment_policy;
#if defined _SCRT_STARTUP_ENCLAVE
static int __cdecl invoke_main()
{
return main(0, nullptr, nullptr);
}
#else
static int __cdecl invoke_main()
{
return wmain(0, nullptr, nullptr);
}
#endif
#endif
static int __cdecl pre_c_initialization()
{
main_policy::set_app_type();
file_policy::set_fmode();
file_policy::set_commode();
if (!__scrt_initialize_onexit_tables(__scrt_module_type::exe))
__scrt_fastfail(FAST_FAIL_FATAL_APP_EXIT);
#ifdef _M_IX86
// Clear the x87 exception flags. Any other floating point initialization
// should already have taken place before this function is called.
_asm { fnclex }
#endif
#ifdef _RTC
_RTC_Initialize();
atexit(_RTC_Terminate);
#endif
if (argv_policy::configure_argv() != 0)
__scrt_fastfail(FAST_FAIL_FATAL_APP_EXIT);
__scrt_initialize_type_info();
// If the user provided a _matherr handler, register it with the Universal
// CRT. Windows OS components cannot set a custom matherr handler (this is
// a policy decision, to reduce complexity).
#ifndef _CRT_WINDOWS
if (__scrt_is_user_matherr_present())
{
__setusermatherr(_matherr);
}
#endif
_initialize_invalid_parameter_handler();
_initialize_denormal_control();
#ifdef _M_IX86
_initialize_default_precision();
#endif
_configthreadlocale(_get_startup_thread_locale_mode());
if (_should_initialize_environment())
environment_policy::initialize_environment();
__scrt_initialize_winrt();
if (__scrt_initialize_mta() != 0)
{
__scrt_fastfail(FAST_FAIL_FATAL_APP_EXIT);
}
return 0;
}
static int __cdecl post_pgo_initialization()
{
// This function calls the _local_stdio{printf,scanf}_options() functions.
// These functions are defined in public headers with external linkage and
// thus may be PGO-instrumented. We must not call these functions before the
// PGO instrumentation library is initialized.
__scrt_initialize_default_local_stdio_options();
return 0;
}
static void __cdecl pre_cpp_initialization()
{
// Before we begin C++ initialization, set the unhandled exception
// filter so that unhandled C++ exceptions result in std::terminate
// being called:
__scrt_set_unhandled_exception_filter();
_set_new_mode(_get_startup_new_mode());
}
// When both the PGO instrumentation library and the CRT are statically linked,
// PGO will initialize itself in XIAB. We do most pre-C initialization before
// PGO is initialized, but defer some initialization steps to after. See the
// commentary in post_pgo_initialization for details.
_CRTALLOC(“.CRT$XIAA”) static _PIFV pre_c_initializer = pre_c_initialization;
_CRTALLOC(“.CRT$XIAC”) static _PIFV post_pgo_initializer = post_pgo_initialization;
_CRTALLOC(“.CRT$XCAA”) static _PVFV pre_cpp_initializer = pre_cpp_initialization;
static __declspec(noinline) int __cdecl __scrt_common_main_seh()
{
if (!__scrt_initialize_crt(__scrt_module_type::exe))
__scrt_fastfail(FAST_FAIL_FATAL_APP_EXIT);
bool has_cctor = false;
__try
{
bool const is_nested = __scrt_acquire_startup_lock();
if (__scrt_current_native_startup_state == __scrt_native_startup_state::initializing)
{
__scrt_fastfail(FAST_FAIL_FATAL_APP_EXIT);
}
else if (__scrt_current_native_startup_state == __scrt_native_startup_state::uninitialized)
{
__scrt_current_native_startup_state = __scrt_native_startup_state::initializing;
if (_initterm_e(__xi_a, __xi_z) != 0)
return 255;
_initterm(__xc_a, __xc_z);
__scrt_current_native_startup_state = __scrt_native_startup_state::initialized;
}
else
{
has_cctor = true;
}
__scrt_release_startup_lock(is_nested);
// If this module has any dynamically initialized __declspec(thread)
// variables, then we invoke their initialization for the primary thread
// used to start the process:
_tls_callback_type const* const tls_init_callback = __scrt_get_dyn_tls_init_callback();
if (*tls_init_callback != nullptr && __scrt_is_nonwritable_in_current_image(tls_init_callback))
{
(*tls_init_callback)(nullptr, DLL_THREAD_ATTACH, nullptr);
}
// If this module has any thread-local destructors, register the
// callback function with the Unified CRT to run on exit.
_tls_callback_type const * const tls_dtor_callback = __scrt_get_dyn_tls_dtor_callback();
if (*tls_dtor_callback != nullptr && __scrt_is_nonwritable_in_current_image(tls_dtor_callback))
{
_register_thread_local_exe_atexit_callback(*tls_dtor_callback);
}
//
// Initialization is complete; invoke main...
//
int const main_result = invoke_main();
//
// main has returned; exit somehow...
//
if (!__scrt_is_managed_app())
exit(main_result);
if (!has_cctor)
_cexit();
// Finally, we terminate the CRT:
__scrt_uninitialize_crt(true, false);
return main_result;
}
__except (_seh_filter_exe(GetExceptionCode(), GetExceptionInformation()))
{
// Note: We should never reach this except clause.
int const main_result = GetExceptionCode();
if (!__scrt_is_managed_app())
_exit(main_result);
if (!has_cctor)
_c_exit();
return main_result;
}
}
// This is the common main implementation to which all of the CRT main functions
// delegate (for executables; DLLs are handled separately).
static __forceinline int __cdecl __scrt_common_main()
{
// The /GS security cookie must be initialized before any exception handling
// targeting the current image is registered. No function using exception
// handling can be called in the current image until after this call:
__security_init_cookie();
return __scrt_common_main_seh();
}