How to store Vector3 for multiple gameobjects

Is there a way I would be able to store the positions of multiple GameObjects, and restore them when triggered by an if function. e.g. if I had three objects:

  • Object1 - x:0 y:0 z:0
  • Object2 - x:1 y:3 z:4
  • Object3 - x:5 y:9 z:-4
    Could I store the Vector 3 for each in a set of data, and when triggered by the if() statement apply all those positions to the objects again?

Yes, there are many ways to do it, I think a script with a dictionary might be the easiest to implement, use the gameObject as the key and a vector3 for the value, then you can loop through them all to apply the positions to each gameObject.