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"

USTRUCT in Gameplay Module crashes Editor on Startup

Hi,

I want to create a (gameplay) module containing a number of generated USTRUCTs which later can and will be accessed via the Editor in Blueprints. Creating those USTRUCTs in the primary module works as expected, but as soon as I move them to another module, the editor crashes on startup (the module's dll builds successfully though).

When starting the Editor via VS, it breaks with the following error message:

 \Runtime\CoreUObject\Private\Templates\Casts.cpp(11)
 Fatal error: Cast of NULL to Package failed
 
 UE4Editor_Communication!CastChecked<UPackage>() + 174 bytes [\4.4\engine\source\runtime\coreuobject\public\templates\casts.h:30]
 UE4Editor_Communication!Z_Construct_UPackage_Communication() + 102 bytes [\unreal projects\moduletest\intermediate\build\win64\inc\communication\communication.generated.cpp:57]
 UE4Editor_Communication!FRespTest::StaticStruct() + 21 bytes [\unreal projects\moduletest\intermediate\build\win64\inc\communication\communication.generated.cpp:18]
 UE4Editor!FEngineLoop::LoadStartupModules() + 71 bytes [\engine\source\runtime\launch\private\launchengineloop.cpp:1772]

The interesting thing is, if I convert everything to a proper UCLASS (e.g. inheriting from AActor), the editor starts up just fine. I can also create a Blueprint based on that UCLASS (appriopriatly defined in the C++ code, of course). I am not sure whether it is an issue in my module setup or a bug in the engine.

Thanks in advance!

The USTRUCT in question

/Source/Communication/Public/RespTest.h

 #pragma once
 #include "RespTest.generated.h"

 USTRUCT(BlueprintType)
 struct FRespTest
 {
     GENERATED_USTRUCT_BODY()
     
     UPROPERTY(BlueprintReadWrite, Category = "MyModule")
     int32 SomeValue;
 };

Module Setup (Reproduction)

What I have done to create the module Communication based on (the documented version seems rather old and confusing):

Directory structure:

 - Source
     - Communication
         - Public
             + RespTest.h
         - Private
         + Communicaton.Build.cs
         + Communication.h
         + Communication.cpp
     - ModuleTest (primary module)

Copied the ModuleTest.Build.cs, ModuleTest.h and ModuleTest.cpp to Communication/ and renamed all occurences of ModuleTest to Communication (filenames and filecontent).

Content of Communication.cpp:

 #include "Communication.h"
 
 IMPLEMENT_MODULE( FDefaultGameModuleImpl, Communication);

I also changed the following files:

Source/ModuleTest.Target.cs

 [...]
 OutExtraModuleNames.AddRange( new string[] { "ModuleTest" } );
 OutExtraModuleNames.AddRange( new string[] { "Communication" } );
 [...]

Source/ModuleTestEditor.Target.cs

 [...]
 OutExtraModuleNames.AddRange( new string[] { "ModuleTest" } );
 OutExtraModuleNames.AddRange( new string[] { "Communication" } );
 [...]

/ModuleTest.uproject

 [...]
     "Modules": [
         {
             "Name": "ModuleTest",
             "Type": "Runtime",
             "LoadingPhase": "Default"
         },
         {
             "Name": "Communication",
             "Type": "Runtime",
             "LoadingPhase": "Default"
         }
 [...]
Product Version: Not Selected
Tags:
more ▼

asked Oct 20 '14 at 01:29 PM in C++ Programming

avatar image

innogames
23 2 4 8

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

1 answer: sort voted first

Module must have at least one UClass so package name can be registered in UE's object system. p.s. if you look inside of AssetEditorMessages.h then you will see dummy class to register package name.

Solution : You should make dummy UClass in the module then you will be fine.

Thanks ProgC

more ▼

answered Oct 23 '14 at 09:00 AM

avatar image

ProgC
26 1 2 1

avatar image innogames Oct 23 '14 at 12:59 PM

Well, I thought I created a dummy UClass, but apparently I did not. It works now as expected, thanks!

(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