Cannot add code to ShooterGame project or make new modules. Any solution?

I created a derivative of ShooterGame called Lastim. When I go to File → Add Code to Project and try to add code to /Lastim/Source/ShooterGame/, I get the following error and I the Create Class button is greyed out:
All source code must exist within a valid module folder in the projects source path, e.g. C:… (it cuts off after /Unreal Projects/

If I change the path to /Lastim/Source/Lastim/, I get the following error highlighted in red above the name and path boxes:
The selected module path does not exist on disk: …

If I manually create a /Lastim/ folder in /Lastim/Source/, I can add the class, but the module does not compile. I have tried adding a Lastim module using different tutorials on AnswerHub and the web, but I have yet to have success. Regardless, shouldn’t it recognize ShooterGame as a place to add code anyway? Reinstalling did not solve anything.

I created an unaltered ShooterGame project just called ShooterGameX, and I have the exact same issues (just replace Lastim with ShooterGameX). I can only edit classes already in ShooterGame. I did not have this issue when following Epic’s tutorial, Introduction to UE4 Programming.

While I am an amateur programmer, I am totally stuck, and I hope that someone can help me add classes to ShooterGame and/or make a Lastim module. I am using Windows 8.1, 64-bit.

You probably are having issues with the header. Try changing the include"example.h" to include “/foldername/example.h”

Thanks for your reply! Sadly, it did not work. I changed the #include “ShooterGame.h” line in ShooterGame.ccp* to “Lastim/Source/ShooterGame/Public/ShooterGame.h” (and all variations under the sun, such as ShooterGame/ShooterGame.h). I forget which ones actually compiled, but I still couldn’t add code through the editor.

I created a project off of ShooterGame with an identical name, and I can add code to it. However, when I create a replica called ShootahGame, I get the same errors from Lastim. It has to do with the name of the directory, but I cannot figure out what to change! :frowning:

*I renamed ShooterGameModule.ccp to just ShooterGame.ccp since the templates just use .ccp, but that did not solve the issue either.

The validation in the class wizard assumes that all the modules in your game will have a name based upon (starting with) your game name, eg, Lastim, LastimEditor, LastimSplashScreen, etc.

Clearly ShooterGame is not at all based upon Lastim, so this validation fails. You’re going to need to rename the ShooterGame module (and any references in .Target.cs .Build.cs and .uproject files) to be Lastim before the class wizard will work.

How did you create your Lastim project? If it was via some sort of wizard then we should make sure that it renames the game modules correctly for you, if you just renamed it on disk, well… there’s not much we can do about that.

With regard to Visual Studio losing the files after you rename them, you’ll need to re-generate the Visual Studio projects after doing the renames. You can do this by right clicking on the .uproject file for your project and selecting “Generate Visual Studio project files”.

I created my project through the Unreal Engine launcher. Whenever I create a project from ShooterGame in the launcher, the folder is always named “ShooterGame”, regardless of what project name I give it. There is no way to create it through the Project Browser.

I’m trying to rename the right files, but Visual Studio loses the files and folders once I rename them, so I cannot compile and my project is broken. I will see what I can figure out on my own, but at least I know the root cause now.

Thank you! I got my project to compile, load in the editor, and add new code. One last question: is there a way to edit Blueprints to redirect them to my new directory and class names? Otherwise, I’ll have to try to recreate all of them.

I’ve checked, and you should be able to do this using ActiveClassRedirects.

If you create a code project from a template, you’ll be able to see an example of some of these in the Config/DefaultEngine.ini file for the project you created (they map the template class name to the renamed class in the project).

[/Script/Engine.Engine]
+ActiveGameNameRedirects=(OldGameName="TP_FirstPerson",NewGameName="/Script/MyTestFirstPerson")
+ActiveGameNameRedirects=(OldGameName="/Script/TP_FirstPerson",NewGameName="/Script/MyTestFirstPerson")
+ActiveClassRedirects=(OldClassName="TP_FirstPersonProjectile",NewClassName="MyTestFirstPersonProjectile")
+ActiveClassRedirects=(OldClassName="TP_FirstPersonHUD",NewClassName="MyTestFirstPersonHUD")
+ActiveClassRedirects=(OldClassName="TP_FirstPersonGameMode",NewClassName="MyTestFirstPersonGameMode")
+ActiveClassRedirects=(OldClassName="TP_FirstPersonCharacter",NewClassName="MyTestFirstPersonCharacter")

Awesome, everything works perfectly. Thank you so much for your help, I cannot upvote you enough!