What are the perks of using [Add Code to Project...]
Up until now I have blindly been adding code to my project with the above menu option, but it occured to me, once i started adding filters to my code in visual studio, that it was clobbering them, even if they had been saved prior or if they were in folders. My question above is, what are the reasons or perks for using this menu option, and when should we be using it. Is it planned to make it so that this menu option doesn't kill my filters?
Loving the toolkit the deeper into the rabbit hole I get.
asked Mar 11 '14 at 02:17 AM in C++ Programming
ue4-archive ♦♦ STAFF
This menu option autogenerates a lot of the Unreal template code that you see in the headers and source files. If you just add a new file in Visual Studio it will initially be blank and you will have to copy in (at a minimum) the following:
for the header and:
for the class file. Note that all this code (especially the copyright line, found that out the hard way) is required or else your code won't compile. Also, the tool creates all the files like
But yes, the feature is a bit WIP at the moment. For a custom folder/filter, I find it easier to generate them in the main directory first, then migrate them and regenerate all Visual Studio files (right-click your .uproject file and hit "Generate Visual Studio Files"). That usually works without problems.
Visual Studio filters are generated to exactly match the directory structure on disk and there is currently no way to avoid regenerating project files while using the "Add Code to Project" feature. Generally, you are encouraged to allow project file generation to organize your filters for you but it is not required.
As William mentioned, this feature is not required to add classes to your project. As long as you create a .h and a .cpp file in the same location that the wizard creates them, the generated code (*.generated.h) will be created at compile time, without the need to regenerate vcxproj files at all.
Follow this question
Once you sign in you will be able to subscribe for any updates here