Custom component keeps dissapearing

I created a custom scene component. Everything is working normal for that class. Here’s an example to show my UCLASS parameters and inheritance.

But then I created another component inheriting that component shown here:

I can attach it to an actor as expected in the editor, but then when I reboot Unreal, it disappears from the actor and I get the following error:

Component class is not set for ‘Dialogue’ - this component will not be instanced, and additional warnings or error may occur when compiling.

As you can see, both classes have the same UCLASS parameters and I add them the same way. Why would I be having this problem? I’ve tried several combinations of UCLASS parameters including BlueprintType, Blueprintalble, and DefaultToInstanced, but nothing seems to be working.

3 Likes

Well, after several days of headache, I found a build-around, but still don’t understand the problem entirely. I basically recreated my component classes again from scratch with slightly different names. Et voila! It works!

So, a little more background for whoever stumbles across this post in the future. I originally had my components set up completely differently inheriting different classes (I think I switched from inheriting ActorComponent to SceneComponent). Around that same time is when the errors started occurring.

My hunch is that it has something to do with editing and refactoring my classes in the source code directly rather than generating the classes from Unreal’s editor. Perhaps there’s some register of the components created? But I never found any reference in the .ini files and rebuilt the project binaries several times, so I’m still not really sure what happened.

2 Likes

The solution is to run the UE editor using the code editor. If you run the UE editor from the epic games launcher and rely on the hot reload, unexpected things happen.

1 Like

I got similar issue while using Visual Studio Community Edition.

Be sure to use Development Editor setup when you compile.
image

All you have to do is just turn off Unreal and then compile your project with Visual Studio. After that you should have component inside BP.