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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

What is recommended class type for manager class?

Hi, i am planning for structure of my code work and i wonder what class type would be nicely fit for manager class.

since i am quite new to unreal and programming, i want to hear all the opinions as i can.

so far, my plan is make a game instance class that store all the manager classes ( like handling object per type or team, handling save data, store or process some data for something and etc ) and that instance class will create all the managers when instance created and destroy when it dies. since the game instance will exist only one instance, it would work well i guess.

before this project i am working on, i learn singleton and use it for manager classes but since either unreal doesn't recommend singleton and recommending use game instance which only can create one instance. i think it is the best way as i can think for now.

long story short, i really don't have any experience for working with unreal. so that i want to hear what class type is best for creating manager class and why.

it would be great if i can hear code structure tips for manager classes ( instead storing all manager classes in game instance class )

Product Version: UE 4.21
more ▼

asked Dec 12 '18 at 02:43 PM in C++ Programming

avatar image

9 2 1 4

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

1 answer: sort voted first

Using your own GameInstance class derived from UGameInstance is the way to go to create that "singleton" like class for your project. This is how I did it on my first UE4 project, and when I went to work for another studio, what do you know, this is also what they did! The GameInstance class as 2 functions you can override that will be useful in your case of creating and managing your game "managers":

 virtual void Init() override;
 virtual void Shutdown() override;

As for the managers themselves, it depends on what you need them to do,, but I would say that 90% of the time, you should just make it derive from UObject.

Hope this helps and good luck with your project.

more ▼

answered Dec 12 '18 at 03:27 PM

avatar image

2.1k 70 37 259

(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