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"

Custom game viewport client in a standalone module

Hi all!

I'm trying to implement a custom game viewport client class and I need to put it inside a standalone module located in Engine/Source/Developer/MuModule. The game project refers to this module in cs file by PublicDependencyModuleNames list and sets the custom viewport class inside DefaultEngine.ini.

The problem is when the engine tries to load the class from MyModule during initialization phase (when GameViewportClient is actually created) it can't locate it inside /Script/MyModule.CustomGameViewportClient - it's simply missing inside MyModule hash.

I have a number of assumption here:

  1. The stanadlone module's uclasses might be registered later then the engine is initialized and game viewport client is created.

  2. I made something wrong with the MyModule structure or configuration so it doesn't register its uclasses at all. Is something special required here?

  3. MyModule isn't propery plugged-in inside the game project. Do I need to register the module references in a special way in order to be able to acces its uclasses?

  4. Something else?

Which one is true?

Any help will be greatly appreciated. Thanks!

Denis.

Product Version: UE 4.12
Tags:
more ▼

asked Aug 26 '16 at 06:07 PM in C++ Programming

avatar image

denis.ischenko
11 1 2 4

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

1 answer: sort voted first

Ok, guys, I've got it.

The problem was that the standalone module with custom game viewport client class inside wasn't referenced directly by the game module. The game viewport class is loaded dynamically with LoadClass in UEngine and I didn't have any other references to its module. Therefore it was silently optimized out by the VC linker and no static initialization of the module took place. As a result - no module's classes registered and no game viewport client class loaded in the end.

Beware of the dynamic class loading! You may miss the module if nothing else refers to it. Epic seems to fix this for plugins in monolitic builds, but not for the case I described. Also consider usage of dynamic loading for decopled modules which you need in any case.

In my case I've just created another game viewport client sibling in the game project inherited from my custom game viewport and this way a necessary reference to its module was created and it stopped to drop out :)

more ▼

answered Aug 26 '16 at 09:09 PM

avatar image

denis.ischenko
11 1 2 4

(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