Create C++ class for Unreal only using Rider

Answered

Is there a way to do this? Right now I have to go into the editor and create them there, wait for the build fail (because I am using a subdirectory and that never works) and then I can see them added in Rider. It would be great if I could right click and just do "new c++ class" in Rider and it would appropriately add them to the project and the build with the right template.

If I just add the new files right now, I still have to go into the editor and regenerate the project files for a build to work and I don't get the templated c++ file. With this, its still easier to use the editor to create c++ classes but not ideal.

2 comments
Comment actions Permalink

Hello Jmc!

This feature is not yet implemented. However, we have a corresponding issue on our bug tracker: RIDER-20397. We would appreciate it if you would upvote the issue in order to demonstrate additional interest and bring increased awareness to the issue.

If you have any other questions, do not hesitate to ask. Have a great day!

0
Comment actions Permalink

So, just a workaround for the sake of it:

I have been getting around this by maintaining a set of File Templates that I build as I need them.  I usually build them using ReSharper in Visual Studio and them export->import them into Rider.  However, because multi-file templates don't work in Rider, I have been maintaining separate .h and .cpp templates for each entity and executing both in their respective directories.  Which is slightly annoying, but does work well enough.

That much is pretty obvious of course.

The one extra bit of info I've found to be useful is:

Often, when you create a new Unreal .h and .cpp file, the code completion and error highlighting doesn't deal with the file correctly.  It'll complain about "incomplete types" and such for unreal classes.  To fix this, I usually go back to explorer and right click on the unreal project file and have it "regenerate project files." Which regenerates the project and build system for the unreal project.  Then, when I alt-tab back into Rider, it picks up the new project files and within a few seconds, all those errors go away and the new files end up being properly seen/handled by Rider.

Doing it this way has allowed me to keep a better targeted library of pre-fabricated objects than Unreal's own templates would provide me.  The thing that made it really work was realizing that I need to manually regenerate project files after I add the source files, and then alt-tab back into Rider after it's done.

2

Please sign in to leave a comment.