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"

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.

Product Version: Not Selected
Tags:
more ▼

asked Jul 08 '14 at 10:01 PM in Using UE4

avatar image

Dakatsu
6 2 3 5

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

2 answers: sort voted first

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.

more ▼

answered Jul 09 '14 at 11:20 AM

avatar image

Jamie Dale STAFF
7.4k 176 66 304

avatar image Dakatsu Jul 09 '14 at 04:25 PM

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.

avatar image Jamie Dale STAFF Jul 09 '14 at 04:34 PM

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".

avatar image Dakatsu Jul 09 '14 at 07:56 PM

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.

avatar image Jamie Dale STAFF Jul 09 '14 at 08:47 PM

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")
avatar image Dakatsu Jul 10 '14 at 06:17 PM

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

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

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

more ▼

answered Jul 08 '14 at 11:47 PM

avatar image

DJMidKnight
1.2k 50 24 50

avatar image Dakatsu Jul 09 '14 at 03:06 AM

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 Shoot*ah*Game, 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! :(

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

(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