Made the mistake of moving 5 files.

I’m sort of at a loss.

I moved some cpp files into a private folder and the headers into a public folder. This is because I was stupidly thinking to myself that file structure done right now, in the long run, will only benefit me.

Welp now the whole project is broken everywhere.

I deleted the .vs, saved, intermediate, and binaries folders

double checked that my build.cs was written correctly

double checked that all includes were going to the write place

double checked that headers were ‘generated’

done the whole “right click generate unreal project files”

Nada. No dice, it’s so bad I’ve had to nuke from orbit and pull the last working backup out.

Why is it so impossible to make a file or move it?
Is this Standard for Unreal? How the heck do people actually work like this?

This is like trying to dig a trench in a thunderstorm while there’s a 50 mile flood and you have a garden trowel.

I Guess I don’t understand how this could be anyone’s good idea for a workflow?

Edit;

Oh my. It got worse, now I have to re-compile the whole engine.

Welp there goes the whole day. Too bad really, all I actually want to do is something completely different than moving 5 files.

I can’t even imagine how anyone could, would, or want to work like this.

This is an untenable nightmare. You can’t even restore from a previous working solution; the whole universe of 390,000 spaghetti mess that is unreal implodes in on itself.

I am gobsmacked that this is supposed to be some functioning, working thing.

Doesn’t seem to actually work to me.

If you share the folder structure and the error you’re getting, it’s easier for someone to give you the solution. :eyes:

What was there;

ProjectFolder

  • /Source
    • /AI
    • /Animations
    • /Gameplay
    • /Interfaces
    • /UI

What I did;

ProjectFolder

  • /Source
    • /Private (only cpp files)
      • /AI
      • /Animations
      • /Gameplay
      • /Interfaces
      • /UI
    • /Public (only h files)
      • /AI
      • /Animations
      • /Gameplay
      • /Interfaces
      • /UI

And the files that were moved into the appropriate folders were duplicates of the /Variant_Combat files. I had made those so I could learn from them. They weren’t actively connected to anything anywhere other than themselves. (so the internal references to each other were already renamed)

After moving them, Visual Studio went ape throwing errors everywhere about not finding any of the header files.

Yes I had the folders set in my build.cs file.

Nothing I did, would make the IDE see the files.

So I decided to backtrack and just put everything back, as soon as I did that all of the other files throughout my whole project folder no longer saw anything and I had several thousand errors.

That then led me to just pull from yesterday’s back up.

Well I guess that was a mistake too as by doing that, I’ve tied up my computer all day as it recompiles 5.8.1; it wouldn’t let me just compile my project itself.

Lessen learned; I will never again move a file and spend a day ahead of time planning out what file I create because, apparently it’s going to cause a complete system failure if you move a file.

At this point I’m not even sure I’m going to continue with Unreal. I’ve been working with game engines since the first version of Doom in early '90s, I have never experienced anything nearly as bad as this, except with the first version of Source engine which was pretty bad.

Edit for the sake of what not to do, here’s what I had done methodically:
(This is also something I had already had to do, because I couldn’t make copies in the IDE and the IDE wouldn’t let me make new files; it literally doesn’t make anything)

  1. Shut everything down
  2. Delete .vs, Binaries, Intermediate, Saved folders
  3. Move the files where I need them to be
  4. Right click uproject and generate unreal project files
  5. load IDE, goto compile project
    1. for my project that means editor, client, & server separately

I couldn’t do step #5 because, and well obviously, it couldn’t find the header files, which I knew and I also knew I was going to have to change the includes to mirror the new locations. Well it didn’t matter, it simply refused to recognize them period.

From there it just avalanched and exploded.

Well recompiling the engine hasn’t resolved the problem, which is what it had wanted to do.

Now;

  • The project isn’t listed in the Games folder in the ue 5.8.1 solution
    • There is no ‘games’ folder there
  • Unable to add it to the solution
  • Unable to load it in the editor, it says “different engine build, rebuild now?”
    • Already re-assigned it to the new compiled engine
  • Rebuild fails, tells me to re-compile the project
  • Project compile fails, tells me it can’t locate the engine.

So I’m back to the loop I was at this morning of not being able to access the project.

I ran the batch file after the compile, it said it succeeded.

Not really sure what else to do besides just saying to heck with it and starting over.

The only issue that comes to mind is with the “Includes”. Make sure the .h and .cpp of your module are in the root folder (Source), Everything else can go in the Public and Private folders. At least in VSCode it generally changes the Includes or creates an additional one for me—for example, from include “Gameplay/MyGameplayActor.h” it adds an extra one or changes it to include “MyGameplayActor.h”. Perhaps someone else can contribute more

Ok. Here’s what finally happened.

I was struggling trying to figure out why I couldn’t add the project & the ‘games’ section in the ue solution.

I ran ~\UE_5_8_1\Engine\Build\BatchFiles\GenerateProjectFiles.bat set to my project (as you do originally)

I got an error; it was looking for a folder that didn’t exist, consequentially one I had created originally before all of this began.

Resolved that.

Was able to run GenerateProjectFiles.bat without errors.

I was able to enter the project back to the state before before VS had implied that the engine needed to be recompiled. I was back to the error list I had before…

…I went back to trying to root it out.

What I found was (and recalled) that I had run a find & replace to rename a class since I was moving a duplicate of a file, had also renamed a single call to a unreal engine class in an engine file (a core file), which once that generated an error it started throwing errors on nearly everything.

It basically broke multiple functions across the board, which then I am guessing the IDE figured the engine needed to be recompiled.

The silliness of it:

  • I was fairly exhausted the night before and just wanted to prep for moving the files I wanted to move, I knew I would have to rename the includes & files along with any unique classes in those files that are defined, so at one point I let it replace all instances. Obviously my search string wasn’t unique enough as it added 3 characters to a completely unrelated class.
  • Then this morning when I went to run things, instead of that single error I was staring at several hundred errors.

What I think I’ve learned:

  1. If you’re going to make/move/duplicate a file or folder, do it in the source-running editor.
  2. Recovery is possible; but don’t let VS push you to compile. I really didn’t need to recompile the whole engine at all; I just needed to find the 1 segment of incorrect characters on a single snippet.
  3. Workflow for code is probably;
    1. Add cpp & h files in Editor.
      1. Edit them in the IDE with Editor closed.
    2. Keep a git include for all the source code/config
    3. Compile project when new code
    4. Do everything else in the editor except altering/adding headers, functions, or create new classes
  4. When in doubt, try running the generate batch files; this actually helped me find out what was wrong and was verbose, more so than the right click generate files.

its always a pain but i havent had any trouble with Redirectors, Rider does it automatically

+ClassRedirects=(OldName=“/Script/MyModule.OldClassName”, NewName=“/Script/MyModule.NewClassName”)

in your DefaultEngine.ini