I have two variables (int x, int y). In different sessions the x variable has different values (lets say in one x = 5, and in other its x = 10). At some point in the game I need to take the x values in both sessions and assign the values into variable y in other session. So the result has to be x= 5 and y = 10 in one and x = 10 and y = 5 in the other. That seems very basic however I could not figure out how to achieve this though an RPC. Could someone help me with this?
What do you mean by “session”? Doesn’t sound like it’s related to Session Management.
If you need to persist or share data beyond the current game session (eg between different servers/hosts) you’d have to save this data to some cloud storage, a database, Firebase perhaps being the simplest option.
No, by session I meant the sides in the multiplayer game being the host and client. So I need to pass the local variable by RPC to the local variable of the other players “session”.
Solved my issue with identfying both variables locally by different functions. I think in case of passing a local variable value to a client we need something specific to the client itself (maybe a bool like isPlayerWonGame). Otherwise I could not figure out how to seperate the clients form one another. Since we use clientrpc it run on all clients so if I make y = 5 it effects on all clients. I don’t know if I explained myself correctly, don’t mind me if this comes nonsense to you