Unreal crashes when Creating default subobjects


so when I want to call CreateDefaultSubobjects<>(), it is fine, Visual Studio finds it. The lines

CapsuleComp = CreateDefaultSubobject<UCapsuleComponent>(TEXT("CapsuleCollider"));
RootComponent = CapsuleComp;

work fine but as soon as I add

BaseMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("BaseMesh"));

and compile it, Unreal crashes completely and doesn’t even show the dialog, it is just gone. When I attempt to reopen the project, Unreal stops at 75 % and just closes again.

When I remove the BaseMesh line and recompile, Unreal starts to open again.

Why and how to fix?

Could you show the contents of the recent log in Saved > Logs

Hello, the top of the log is as followed:

Log file open, 11/13/22 22:42:23
LogWindows: Failed to load 'aqProf.dll' (GetLastError=126)
LogWindows: File 'aqProf.dll' does not exist
LogProfilingDebugging: Loading WinPixEventRuntime.dll for PIX profiling (from ../../../Engine/Binaries/ThirdParty/Windows/WinPixEventRuntime/x64).
LogWindows: Failed to load 'VtuneApi.dll' (GetLastError=126)
LogWindows: File 'VtuneApi.dll' does not exist
LogWindows: Failed to load 'VtuneApi32e.dll' (GetLastError=126)
LogWindows: File 'VtuneApi32e.dll' does not exist
LogWindows: Started CrashReportClient (pid=15492)
LogConsoleResponse: Display: Failed to find resolution value strings in scalability ini. Falling back to default.
LogConsoleResponse: Display: Failed to find resolution value strings in scalability ini. Falling back to default.
LogInit: Display: Running engine for game: ToonTanks
LogCore: UnrealTraceServer: Trace store launch successful
LogCsvProfiler: Display: Metadata set : platform="Windows"
LogCsvProfiler: Display: Metadata set : config="Development"
LogCsvProfiler: Display: Metadata set : buildversion="++UE5+Release-5.0-CL-20979098"
LogCsvProfiler: Display: Metadata set : engineversion="5.0.3-20979098+++UE5+Release-5.0"
LogCsvProfiler: Display: Metadata set : commandline="" Q:\ToonTanks\ToonTanks.uproject""
LogCsvProfiler: Display: Metadata set : os="Windows 11 (22H2) [10.0.25236.1010] "
LogCsvProfiler: Display: Metadata set : cpu="AuthenticAMD|AMD Ryzen 9 5900X 12-Core Processor"
LogCsvProfiler: Display: Metadata set : pgoenabled="0"
LogCsvProfiler: Display: Metadata set : loginid="15b9262a49ef9e26ce9aba8442861404"
LogCsvProfiler: Display: Metadata set : llm="0"
LogPlatformFile: Not using cached read wrapper
LogStats: Stats thread started at 0.216253
LogICUInternationalization: ICU TimeZone Detection - Raw Offset: +1:00, Platform Override: ''
LogInit: Session CrashGUID >====================================================
         Session CrashGUID >   UECC-Windows-EE2A45774F70A893F8B2839A2AE4A55C
         Session CrashGUID >====================================================

Could you please show the whole log? Use a site like pastebin.

This is the log “ToonTanks.log” immediately after the successful compilation:
Unreal crash after CreateDefaultSubobject - Pastebin.com
Just to be sure that there is no mistake, this is the C++ Source code of BasePawn.cpp:
C++ class “BasePawn” - Pastebin.com

Sorry for the late response. Could you try delete the Binaries and Intermediate folders and rebuild by attempting to reopen the project?

It doesn’t help to delete the Binaries and Intermediate folders

Would you mind posting the new logs that were generated from that? Hopefully they are different and give further insight.

Of course, it is not a problem

That’s more useful. Could you show the BasePawn.h and .cpp please?

May I ask what you found out from the log?


[2022.11.18-15.22.42:095][533]LogWindows: Error: === Critical error: ===
[2022.11.18-15.22.42:095][533]LogWindows: Error: 
[2022.11.18-15.22.42:095][533]LogWindows: Error: Fatal error: [File:D:\build\++UE5\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\Obj.cpp] [Line: 118] 
[2022.11.18-15.22.42:095][533]LogWindows: Error: Using incorrect object initializer.
[2022.11.18-15.22.42:095][533]LogWindows: Error: 
[2022.11.18-15.22.42:095][533]LogWindows: Error: 
[2022.11.18-15.22.42:095][533]LogWindows: Error: 
[2022.11.18-15.22.42:095][533]LogWindows: Error: 
[2022.11.18-15.22.42:095][533]LogWindows: Error: [Callstack] 0x00007ffd37dd2eee UnrealEditor-CoreUObject.dll!UnknownFunction []
[2022.11.18-15.22.42:095][533]LogWindows: Error: [Callstack] 0x00007ffc85121887 UnrealEditor-ToonTanks-0002.dll!ABasePawn::ABasePawn() [Q:\ToonTanks\Source\ToonTanks\Private\BasePawn.cpp:23]

The last line effectively saying there’s something wrong with your constructor code on line 23 and if you look at that line you have


which is your error. You want to assign TurretMesh (which is currently uninitialised at this point) not call a function on it. That line should be

TurretMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("TurretMesh"));

The base pawn should be creating the static mesh component, not the mesh component itself.


Oh god, such a little typo! Thank you very much sir, it works now :grinning_face_with_smiling_eyes:

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

Privacy & Terms