Announcement

Collapse
No announcement yet.

UniqueID different on client then server

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    UniqueID different on client then server

    I'm running some tests for my understanding of when a player joins a map with a custom GM, and on postlogin(), logout the uniqueid from the passed in NewPlayer->PlayerState->GetUniqueID() which gives me a certain number on the server.

    In the client custom GameState for this map, on the function AddPlayerState which is supposed to add the new player to the PlayerArray upon joining the map, I logout from the passed in PlayerState->GetUniqueID() which gives me a different number than what is logged on the server.

    I even, set a 5 second timer to log the client id a second time to see if the server/client have replicated properly, and tested on the same machine both server and client running the null subsystem and the different numbers still show up. This is testing with the first player joining the map.

    I've read that sometimes the PlayerArray can be zero before the GS has had a chance to initialize, but I am not getting zero...I am getting a number that is different from the server...I've also tested from the PlayerArray[0]->GetUniqueID().

    I thought the UniqueID was supposed to be a replicated number maintained on both client and server...I was expecting it to match. Does anyone know why it doesn't, or am I missing something in my limited knowledge thus far?


    #2
    UniqueId is basically the index into an array of whatever UObject type you created so depending on when objects are created (and how many), the value will be different between client/server. It's not replicated and values are re-used as objects are deleted/instantiated.

    You really shouldn't be using it for anything as the value will differ even between game sessions on the same client depending on the order of operations the user takes.
    Able Ability System - A high performance, robust ability system for UE4. Now Available!

    Comment


      #3
      Thanks for the clarification. I'll handle things in a custom way instead.

      Comment

      Working...
      X