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"

variable persistant (Dedicated Server)

Hi,

I have a array and I would like to know where I should place it (currently in GameMode). Each client adds an item to this array when they log (by login system).

After the log , the client travel to another map. And at this moment when a client try to retrieves the array , he's empty.

If anyone have an idea , sorry for my english.

THX

Product Version: UE 4.19
Tags:
more ▼

asked Sep 03 '18 at 08:38 PM in Using UE4

avatar image

KrazyApple
23 1 6 8

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

2 answers: sort voted first

Game Mode does not replicate over network. So you are right - it will forget the values as soon as the next level loads. But you are on a Dedicated Server. You can tell that Server (in a Server RPC) to update the variable if you have placed it in the server's GameInstance (and your GameMode uses that class of GameInstance that has your variable/array), and it will remember it on the Server side. If you need it to tell the Clients, it will remember after Travel, and you can tell the clients in a MultiCast or something like that.

more ▼

answered Sep 03 '18 at 11:24 PM

avatar image

mightyenigma
3.8k 18 23 20

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

Thanks for you answer !

I made a scene with the Login and you can be connected to the Dedicated Map if your identified.

When a client is log , he add his struct into the list of the GameInstance (by RPC) and after i call the "OpenLevel (with Ip address)". My print of the length of this array in the GameMode is equal 0. So I think because I add to the list before the client is not connected to the dedicated server my datas are not update in the server.

Did I have to open the scene of the login in the dedicated server to update the array of the GameInstance or its weird ?

Or maybe an other solution ?

Anyway thanks for you answer again , thx

more ▼

answered Sep 05 '18 at 04:36 PM

avatar image

KrazyApple
23 1 6 8

(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