I am having this nasty and frustrating bug for quite some time and I am unsuccessful capturing it. Game randomly crashes the editor, in stand alone mod or in final build (Shipping or Debug Game). All I am getting is Assertion failed: !IsRooted message and the game/engine crashes. Any suggestions on how to approach this problem?
In case this helps anyone in a similar situation, this only started happening after I added AudioComponent->AddToRoot(). Removing this line prevents the crash for me.
I ran into this recently too. How things ended up in this state is kind of convoluted (basically an asset deletion that didn’t finish cleanly), and I’m still not 100% clear on what was actually happening, but long story short: renaming the asset that kept triggering the assertion revealed an “empty package” asset with the same name in the same directory. Deleting that empty package and then renaming the asset back to its original name fixed the issue. (There may or may not have been a redirector cleanup involved too.)
Pretty niche bug, but I’m 100% sure I’ll run into it again, so this post is mostly for future me.
EDIT: So I figured out more precisely how/why this happened:
I’m using revision control (Git with LFS for binary assets)
I don’t have my Git repo “connected” to the Unreal Editor (though I’m not sure if that’s actually necessary to reproduce the issue)
Move some asset that’s already been committed to version control into another folder
At this point:
Git will show no changes to the assets at the original location (as if they’ve simply been copied)
Unreal Editor will show some unsaved changes in the bottom right of the UI. Opening that dialog will reveal your moved assets as “empty packages” that need to be saved.
Exit the editor without saving those “empty package” changes (in my case, the editor crashed at some point later, for completely unrelated reasons)
Next time you open the editor, the assets you had tried to move are present in both their old and their new locations. Proceeding to treat these not-quite-deleted assets like they’re totally fine is what triggered the issue for me.
In my case, I had renamed the assets (not strictly the same thing as a move, but functionally equivalent), and then later decided that actually I didn’t need to delete one of the old ones, because I had wanted to make a copy with some modifications anyway. That was a bad idea. Moral of the story: If you’re using version control and you move or rename an asset, make sure you check the editor for unsaved changes and save those “empty package” assets as soon as possible.
In hindsight, it’s also likely that manually clearing/invalidating my Derived Data cache could have also resolved the issue. (The only explanation I can think of is that some piece of my project model that’s not checked in to version control was misinformed about the actual state of my assets on disk, and the only persistent piece of my project model that’s not in version control is my DDC.)