x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

How do I remove Code From Project?

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.

Product Version: Not Selected
Tags:
more ▼

asked Mar 23 '14 at 09:36 AM in C++ Programming

avatar image

User-658380556
184 22 36 157

avatar image User-658380556 Feb 22 '15 at 04:54 PM

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.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

?

I am not sure I understand the question,

if you are compiling in VS, and you delete the .cpp and .h from your Source folder,

and then recompile

Doesn't that work for you?

Rama

more ▼

answered Mar 23 '14 at 09:42 AM

avatar image

Rama
10.6k 446 343 1085

avatar image User-658380556 Mar 23 '14 at 09:47 AM

Yes, but lets say you had originally made an actor called "AssistantManager", but later on for w/e reason, decided you wanted to use the AssistantManager name to describe a GameManager class.

"Once you create a project a lot of internal linking occurs based on the name you choose for the project." https://answers.unrealengine.com/questions/14385/change-fileclass-names.html

Would you still have to go into the config and ini files and reconfigure all that internal linking?

avatar image Rama Mar 23 '14 at 09:49 AM

The real issue is only with renaming your entire project,

renaming individual classes, or deleting them, should work quite fine!

I did a lot of that today actually, in new UE4

it's perfectly fine :)

Not sure if I am understanding situation perfectly

but if you rename or delete .cpp and .h files you're fine

except if you make blueprints and reparent them to a C++ class

then you should make a NEW class that is renamed version

reparent the BP to the NEW version

then delete the old one

its still quite doable

avatar image Rama Mar 23 '14 at 09:55 AM

You Are Going to Be Fine

You are gonna be okay, just remember the one bit about blueprints that are reparented

and dont delete classes till you are ready to let go of the BP, or transfer it to a new parent first

avatar image User-658380556 Mar 23 '14 at 09:56 AM

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.

Thanks for the timely answers.

avatar image BrynBennett May 01 '14 at 03:53 PM

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.

avatar image Ghar Feb 03 '15 at 02:46 PM

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.

What is the correct way to delete them?

avatar image cancel Feb 03 '15 at 03:06 PM

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.

avatar image AsLogd Feb 09 '15 at 05:56 PM

Thank you, this is what happened to me

avatar image User-658380556 Feb 22 '15 at 05:19 PM

This. This was my issue too. Looking back Rama was trying to tell me this from the start.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

They would be in the address similar to: MyDocuments/Unreal Projects/ Your Project / Source / Your Project / Public (and also Private)

more ▼

answered Feb 03 '15 at 07:29 PM

avatar image

spazchicken
447 35 20 53

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question