Search Unity

Replay System for Multiple Objects Seperately

Discussion in '2D' started by t_rex987, Oct 21, 2020.

  1. t_rex987

    t_rex987

    Joined:
    Oct 21, 2020
    Posts:
    5
    Hello to everyone. I want to make a replay system for more than one moving object.

    So I think that the movements we make in each part of a scene will be recorded and played in the next episodes (like the mobile game-does not commute).

    I am storing all these positions and rotation in a class. But do I have to save them? How should I save them if necessary?

    Game:
     
  2. Lo-renzo

    Lo-renzo

    Joined:
    Apr 8, 2018
    Posts:
    1,514
    By save I'm assuming you mean save to disk. If it's like the above game, you probably don't need to save them at all. The player restarts at a particular checkpoint. That's what needs to be saved. Checkpoints are a useful system for reducing serialization complexity because they eliminate a ton of data that might need to be saved if you were to allow the player to resume at any point.

    If you were wanting to save them, however, you would likely want to use a json serializer like JSON.NET, if complex, or - if simple, limited and security isn't an issue - dump a json string into PlayerPrefs.

    Since the above example seems relatively simple, you could probably get away with just saving which checkpoint the player reached in PlayerPrefs, and how many credits they have. At least that would be sufficient for the time being.
     
    t_rex987 likes this.