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"

How to handle Systems / Controllers in UE4?

Hi everyone,

we are developing a kind of CAD application using UE4 and I'm constantly facing this annoying problem: let's say I have my main controller (eg. entry point of my custom application) where I bind inputs to handlers, instantiate uobjects, spawn default actors.. many of these uobjects are systems / subcontrollers / services that will get called everywhere in my codebase (objects factories, network services, etc.).

I was thinking about creating some kind of resolver much like in a dependency injection scenario where you configure your container by registering types. The actual implementation would ideally require a TMap[FString, UObject*] where all the instances are stored. But this approach leaks memory as uobjects in tmaps get garbage collected.

How would you manage instances of these kind of objects in such application? Right now I have an UPROPERTY for each system / service in my main controller, along with getters, and each spawned actor has a reference to the main controller.. I feel like this implementation doesn't scale well should we start adding more and more systems to it.

Have a nice day, Michele M.

Product Version: UE 4.14
more ▼

asked Apr 06 '17 at 10:53 AM in C++ Programming

avatar image

3 1 4

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

1 answer: sort voted first

I think it's fine as lot of engine code do what are you doing, there is centralized main UEnigne class which contains references to lot of other engine subsystems


You can also make some static pointer to it with TWeakObjectPtr, or just make singleton access point in the module class same lot of engine modules have with Get() function:


Also think if you really need to use UObjects for you system if you doing C++ only, some API are sitting in module class like HTTP i showed above. Module classes can be also accessed via module manager


more ▼

answered Apr 06 '17 at 11:42 AM

avatar image

37.8k 937 172 1123

avatar image mmischitelli Apr 12 '17 at 08:17 AM

Thank you for your insight. Modules are indeed what I was looking for!

(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