Actor component removing itself from actors after engine restart?

I’m using a Blueprint actor component that handles spawning loot for my NPC’s in the game. This component is used in many other places as well, such as treasure chests which also use it to spawn loot.

For some reason, recently, each time I restart the engine, test the game and trigger an NPC to spawn any sort of loot, I get the error: “Accessed None trying to read property BPC_LootSpawn” even though the component is still there. The NPC blueprint still compiles like normal even while this issue is happening, and the only real indicator I have that there’s something wrong, is that the component can’t be duplicated by right clicking. After I restart the engine again, sometimes the component is entirely gone.

Replacing the component and replacing all references in the NPC blueprint fixes the issue… until I restart the engine again. I packaged a project for Steam recently and the component IS broken in the packaged build, but I don’t know if was fixed in the editor beforehand because I hadn’t had time to explore the issue.

I combed through my NPC and I know for a fact that it’s never being removed anywhere unintentionally. This has got to be some sort of bug, and I really need to find a fix for it. It’s about 5 to 10 minutes of work to get it up and running each time I start my project back up.

I had the same problem with the Cable Component, gets removed each time I relaunch the project. Your actor is loaded BEFORE your component is, at that time it does not know what your component is since it does not exist.
You have to add in the .uproject the module of your component and make its LoadingPhase as PreDefault instead of Default. Or you can directly edit the component in the engine files so it will work for all your future project aswell.
image
My .uproject file edited with Notepad++

2 Likes

This fixed my issue. In my example, I created an actor component in C++ that I wanted to be able to put on a character. The actor component was in a plugin so I edited the .uplugin file. Same thing though.