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
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.
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