Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Deterministic entities serialization

Discussion in 'Physics for ECS' started by lijianfeng, Nov 7, 2019.

  1. lijianfeng

    lijianfeng

    Joined:
    Sep 8, 2015
    Posts:
    54
    If I serilize all the rigidbody,and remove all of them from world.then I deserillize them and put them back to world.Does it guarantee deterministic result ? or I need to restep game from start? o_O I plan to use this way to save game state and reappear my game.
     
  2. Rory_Havok

    Rory_Havok

    Joined:
    Jun 25, 2018
    Posts:
    70
    If BuildPhysicsWorld sees the entities in the same order as it originally did, then the simulation results will be the same, becuase the PhysicsWorld will be the same. So I think the question is whether your process of serialize->remove->deserailize could interfere with the entity order.
     
    lijianfeng likes this.