Earlier I asked about changing a classes name, it was suggested that it would be easier to make a new class instead. I asked because I like to keep my projects clean, and refactoring is a large part of that. So, if one were refactoring, the need might arise to remove some classes/files from the project. How is this done?
Let me be more clear. The issue I was having is that once I created a class I was no longer able to create new classes with the same name, even if I deleted the class from my project. If you can only use class-names once, In a large project it’s not hard to imagine someone wanting to use a class-name that belongs to a class that’s been deleted.
Hmm okay. I think there was some misunderstanding in our original discussion. I’m going update that original question when I can do so accurately, as the sources/issue I had at the time has been deleted.
Strange. Today I made a project and added a few test files in the editor. Then, I deleted them from the solution and recompiled. But, they were still available to be placed when I ran the editor again.
It’s an old question, but I couldn’t find an answer.
I deleted a class in visual studio by deleting the .h and .cpp files, then recompiled. Then in the editor I also recompiled, but then I tried “Refresh Visual Studio Project” and it brought the files back again.
You need to actually delete the files from the folders using Windows Explorer by hitting delete or throwing them in the Recycle Bin (or just move them to your desktop or wherever). When you delete them in Visual Studio, you’re probably only deleting their existence in the project, and not the files on the disk. So when you recreate the project files, the Unreal build tool sees the files still in the directory, and puts their entries back into the project.
It’s been a while since I followed up on this, but things are working as people are saying. For example.
I added an Actor called MyActor, compiled, rebuilt, made a blueprint out of the MyActor class, deleted it, closed UE4, deleted MyActor.h/cpp from both the project and the filesystem, rebuilt, and tried to make a new blueprint based off MyActor and as one would expect, it was gone.
Then I tried to do what I did that spurred me to make this thread in the first place. I tried to add a new MyActor class via the Editor and I no longer had problems. I don’t know if this was just a previous version issue or an error on my part, but I suspect it was that I was only deleting the files from the solution, not the source folder.