Announcement

Collapse
No announcement yet.

UFactory class in Development build issues.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    UFactory class in Development build issues.

    Hi all,

    I have my own factories to be used within the editor and they're part of my main game project, when I build the development game I get errors because UFactory is part of the UnrealEd module...so my question is how do I only remove them from the game builds? I've tried creating a plugin for the factories but they need access to game classes which became messy quickly.

    Thanks,
    Mike

    #2
    You need to create a second module in your project, in which you put any code that is editor-only (such as UFactory). You can set it up with just the same structure that the default created module has.
    Then you make an entry in your .uproject file specifying that the module is editor-only:
    Code:
    {
        "Name": "MyEditorModule",
        "Type": "Editor"
    }

    Comment


      #3
      Hi kamrann,

      Thanks for your response, I created the factory module but the factory uses a class which is in and needed in the game module, I can't figure out how to do this as you'll get cyclic issues...unless I'm missing something?

      Mike

      Comment


        #4
        Hey,

        I did the same yesterday, add your game module to the editorbuild.cs file

        This is the topic about my custom asset: https://forums.unrealengine.com/show...eference-issue

        The file is located
        {ProjectRoot}\Source\SwatReloaded\Public\Data\SwatCampaign.h

        So i added
        {ProjectRoot}\Source\SwatReloadedEditor\Public\SwatCampaignFactory.h

        and my build file (which reference the game module)
        {ProjectRoot}\Source\SwatReloadedEditor\SwatReloadedEditor.Build.cs
        Code:
        // Copyright 2015-2016 Deborggraeve Randy. All Rights Reserved.
        
        using UnrealBuildTool;
        
        public class SwatReloadedEditor : ModuleRules
        {
            public SwatReloadedEditor(TargetInfo Target)
            {
                PrivateIncludePathModuleNames.AddRange(new string[]
                {
                    "AssetTools",
                });
        
                PublicDependencyModuleNames.AddRange(new string[]
                {
                    "Core",
                    "CoreUObject",
                    "InputCore",
                    "Engine",
                    "UnrealEd",
                    "SwatReloaded", //<=== REFERENCE GAME MODULE
                });
        
                DynamicallyLoadedModuleNames.AddRange(new string[]
                {
                    "WorkspaceMenuStructure",
                    "AssetTools",
                    "AssetRegistry",
                    "ContentBrowser",
                });
            }
        }

        Comment


          #5
          Hi Fallonsnest,

          Thanks for replying, I've got it sorted now, seeing your ModuleRules helped.

          Thanks again,
          Mike.

          Comment

          Working...
          X