I’m a veteran C++ dev, but so far I’ve only been working with blueprints in Unreal. I’m now attempting to mix the two.
I have a blueprint actor I’d like to attach a component to, but the actor component is defined as a C++ class. The class doesn’t show up in the editor as an addable component. As far as UE5 is concerned, that class doesn’t exist (even though I used Tools->New C++ Class to create it).
I have meta=(BlueprintSpawnableComponent) in the UCLASS definition at the top of the header. So far, everything is just as UE generated it - no changes.
I’ve tried building the solution through VS and also restarting UE to no avail. I noticed the .cpp and .h for the new class weren’t included in the VS solution by default, so I had to add them manually. That also did not fix the problem. I’m getting roughly 10k errors when I try to build in VS, but it’s my understanding that I should ignore those.
Did you use the unreal editor to create the new component class?
If not, you will need to regenerate the visual studio project files.
For Unreal to find the class.
Other base question:
Your class is in the right folder? (PROJECTFOLDER/Source/MODULENAME)
Also 10k errors sounds horrible, depending on what you are compiling you might get some warnings, but if you just compile the game and not the engine you should default be warnings and error free. And maybe get some warnings on startup.
I did create the class via unreal editor, but it didn’t alter the VS project. I had to install dotnet-runtime-3.1.32-win-x64 (which I was apparently missing) and then I was able to regenerate the solution. Now the class shows up in the editor.
I think the 10k errors were for the entire solution. I’m only getting 8 from the actual game project.