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"

Hide code when cooking?

Hi all,

Quite new to Unreal and this week I worked on creating a class that represent a "road" for a race mini-game. The way I went about doing it is using SplineComponent and SplineMeshComponent. Also, in this class I override the OnConstruction function to do some stuff in editor.

It does a lot of stuff and, for example, it will trace the World in search of the ground so that the spline is always correctly sitting on it. It works fine in the editor and in standalone. The whole OnConstruction script is done in a #WITH_EDITOR block, since I want this stuff happening when the editor is builded in. So I compile my "Dev" configuration, it works, and when I compile in "Dev Editor" it also works correctly.

My problem arise when cooking the data. It will try to load a module which should not exist (the LevelEditor) from a function call within the OnConstruction function, and this make the cooking process fail.

Is there a way (like a #IS_COOKING define, for example) to make sure the editor stuff is not running while the editor is cooking?

Or maybe I'm not working correctly, is there an other way to do this? Have an object have Editor functionnality in the editor but have those stripped out in the final game?

For reference, I had to do this on my module rules to make this work correctly when compiling in Dev and Dev Editor configs :

         PublicDependencyModuleNames.AddRange(new string[] { "Core", 
                                                             "CoreUObject", 
                                                             "Engine", 
                                                             "InputCore",
                                                             "HeadMountedDisplay" });
 
         if (UEBuildConfiguration.bBuildEditor == true)
         {
             PublicDependencyModuleNames.Add("UnrealEd");
         }

 

Mick

Product Version: Not Selected
Tags:
more ▼

asked Dec 05 '14 at 07:40 PM in C++ Programming

avatar image

MickD777
2.1k 70 38 259

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

1 answer: sort voted first

GIsCookerLoadingPackage might be what you're looking for. I've not had cause to use this myself yet though.

Another option is to have the spline components align themselves to the terrain from an editor only function such as PostEditChangeProperty rather than in the construction scripts. This would help separate your logic.

more ▼

answered Jan 01 '19 at 08:12 PM

avatar image

phil_me_up
1.5k 6 6 12

avatar image phil_me_up Jan 01 '19 at 08:13 PM

Just realised this was from 2014! Sorry for reviving.

(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