(Project Crash At Load) Assertion failed: Template

The project crashes at load. I converted the project and started fixing bugs. I decided to shut down the editor without saving a few files and now I can’t open it anymore. I’d like to note this is a c++ project but all my code compiles fine before and after the crash.

The main line that sticks out from the crash is at the top, but I’m not sure what it means.

Assertion failed: Template [File:D:\Build\++UE4+Release-4.15+Compile\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\LinkerLoad.cpp] [Line: 3903]

Here is the crash text.

Here is the saved log text.

Any help would be greatly appreciated, Thanks!

Hey ALegendsTale-

A crash on load usually indicates a null pointer being referenced. Though the code will be correct and compile, when the pointer is read it isn’t actually pointing at anything so the program doesn’t know what to do. Please check the constructor for your classes to see if there is a pointer not being set. If possible, please provide a copy of the project to help me investigate the issue further.

I don’t see anything that isn’t being constructed besides my arrays in a few USTRUCTS. I’m still a bit new to c++ so I’m not sure how to set everything to null or 0 since I’m using them as blueprint variables.

Here are my USTRUCTS.
Here is my SaveGame.

Something to add is my USTRUCTS all have constructors but my SaveGame does not.

These two are the only things in my c++ that have been changed since the crash, and I investigated the new code but changing/removing doesn’t stop the crash. After the crash on 4.15 I tried working on 4.14.3 again to get some more stuff done before converting this time and it now crashes with the same issue as well so it isn’t a result of the update.

Thank you for any help! I might try another copy of the project and see what happens if I move some of my code/new files over to it.

Edit: I diffed the code from the previous revision (Which worked fine) and here are the exact differences:

USTRUCTS

  • Line 165
  • Line 188 - End

SaveGame

  • Line 47

Everything else that was modified derives from blueprint with the exception of one map that was edited.

I will try debugging as you said tomorrow (I’m actually just heading to sleep). If I still am having issues then I would be happy to share a copy.

The only issue is how as the project is quite large (Space mostly taken by assets). Something else to add is due to my internet speeds, it might also take a very long time.

Once again thanks for the help!

I noticed two pointers in your structs that are set to Null in their constructor (UTexture2D* Thumbnail & USoundBase* ShopOpeningSound), are these values set to anything before being used in the code? Additionally, if you run the project in VS debug mode, what is the value of Template at line 3903 of LinkerLoad.cpp when the error occurs? If the value is null, please check the values of the “GetArchetypeFromRequiredInfo()” parameters on the line above. It may also help if you could provide a copy of your project to help me investigate the issue locally.

The best way would be to upload the project to google drive / dropbox / etc. and then provide a download link for the project. You can send the link through a PM on the forums for privacy is desired.

One more thing before I go that I forgot to mention. I’m pretty sure the two pointers are being set after but not 100%.

Is there any default texture or soundbase I can use instead of null? If not I will just research how to set them properly using one of my textures/sounds inside the editor.

There is not a default texture/soundbase to use instead of null. Rather, what I was saying is that before using these pointers (for example Thumbnail->AddToRoot(); ) you will need to set it to something other than null, ideally a reference to an asset in your project. If possible, please provide a copy of your project to help me investigate what is causing it to crash on load.

I tried debugging and failed to correct the crash. I did as you said and went into debugging, viewed what value the template was currently at, and as I expected it is one of my main actors that I use in my inventory system. This same actor has ties to one of the pointers we mentioned before (UTexture2D* Thumbnail). I tried setting the texture to something other than null but I don’t think I implemented it correctly. I also tried removing the texture from my struct completely but that didn’t seem to affect anything. Then I grabbed a previous copy of the project before some changes I made and tried to figure out what changed, but I found nothing wrong.

In the end I decided that I would try uploading the project to send but because of its size I had to remove most of the assets. After I zipped it up, uploaded, and then sent you a link via pm as you mentioned before.

Hopefully enough of the project is there so that it will allow you to debug it. The upload took roughly 3 hours for 600mb.

Hey ALgendsTale-

After debugging in Visual Studio I was able to isolate the issue to what appears to be the BP_PickUpItem_Main.uasset file. Removing this file from the project (copied to desktop) prevented the startup crash. It appears this particular blueprint has been corrupted at some point and may need to be recreated. If you remove this from your project you should be able to open the project successfully.

Cheers

Doug Wilson

Thank you for taking the time to help me Doug! My only last concern is that it will corrupt again due to something I missed since two of my projects have done this now (4.14.3 and 4.15). That specific actor is a central part of my project which is why I hadn’t tried removing it. I will replace it with one that is uncorrupted from a clean project.

This has also taught me how to debug better in Visual Studio so next time I won’t be as helpless.

Thank you again!

ALegendsTale

So I removed the old corrupted one and put in a clean file but when launching it seems to corrupt the clean one as well. Could this be due to my c++?

Edit: Through more testing I have found the issue isn’t the blueprint its self. Something else is corrupting it on load so it isn’t actually the issue. I took a corrupted blueprint and moved it into a clean project and it worked fine. I’m not sure what else could be corrupting it besides my c++. I’m still thinking those pointers you mentioned that are set to null should be set but I can’t figure out how to do that using FObjectFinder since it doesn’t seem it can be used in structs.

Edit 2: The crash was not being caused by BP_PickupItem_Main. It was actually caused by BP_Inventory which somehow altered PickupItem at load.I replaced BP_Inventory with an earlier version from my source control and did the changes I made before with one exception, saving NPCActors. For some reason that seems to have been causing the crashes because I can’t reproduce them now.

Thanks for all your help!