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"

In what baseclass should I place a manager class

So I am working on an AI plugin, and I need a manager which will calculate covers and flanking possibilities for AIs. I want to do this in a manager to get better performance. I want this manager class to loaded during play, and if possible without placing it as an actor in the level. I don't want to edit the UE source code, because it's a plugin. This manager class has to have a beginplay or onlevelload and a tick (I can add that if needed though). What is very important as well, is that everything associated with AI has to have an possibility to comunicate with it, kind of like an actor, but if possible with a 'getmanagerclass' function. It also has to have an way to spawn actors in the world. What would be the best class to use?

Thanks in advance

Erik

Product Version: UE 4.15
Tags:
more ▼

asked Feb 23 '17 at 05:32 PM in Using UE4

avatar image

erik321123
413 17 15 31

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

1 answer: sort voted first

We put things like this on the GameMode. you can call GetGameMode()->CastToYourGameMode()->GetManager() (and even cache it locally if you'd like). If it needs to persist between levels, then the GameInstance is a better place. (Create a custom one-- you can use GetGameInstance() anywhere in blueprints just like GetgameMode())

In C++ these are in UGameplayStatics::GetGameMode and GetGameInstance

more ▼

answered Feb 23 '17 at 05:46 PM

avatar image

DigitalMage
401 11 8 25

avatar image erik321123 Feb 23 '17 at 07:43 PM

Gamemode seems to suit, however does it have any event that triggers when you start playing? And could I do GetWorld() from it? Thanks for your response

avatar image Wurmloch83 Feb 23 '17 at 07:59 PM

I also use GameMode for such manager objects (that shall only exist on server).

There exist, beside others, virtual void StartPlay(); virtual void BeginPlay();

StartPlay calls BeginPlay() on other Actors etc, afterwards comes BeginPlay in GameMode.

Yes you can call GetWorld().

avatar image erik321123 Feb 23 '17 at 08:09 PM

Thank you very much!

(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