public void GameObjectReferencesAreSerialized()
        {
            string     id1     = "object1";
            string     id2     = "object2";
            GameObject object1 = Object.Instantiate(m_testPrefab);

            object1.name = id1;
            GameObject object2 = Object.Instantiate(m_testPrefab);

            object2.name = id2;
            TestSavableBehaviour behaviour1 = object1.GetComponent <TestSavableBehaviour>();
            TestSavableBehaviour behaviour2 = object2.GetComponent <TestSavableBehaviour>();

            behaviour1.gameObjectReferece = object2;
            behaviour2.referenceContainer = new TestReferenceContainer {
                gameObjectReferece = object1
            };

            var      builder  = new MockModelBuilder();
            SaveGame saveGame = SaveGamePacker.PackSaveGame(new[] { object1, object2 }, builder.GetSavableMonobehaviours());

            SerializeAndUnserialize(saveGame, builder, AllSaveablePrefabs);

            GameObject newObject1 = GameObject.Find(id1);
            GameObject newObject2 = GameObject.Find(id2);

            Assert.AreEqual(newObject2, newObject1.GetComponent <TestSavableBehaviour>().gameObjectReferece);
            Assert.AreEqual(newObject1, newObject2.GetComponent <TestSavableBehaviour>().referenceContainer.gameObjectReferece);
        }
        public void MonoBehaviourReferencesAreSerialized()
        {
            string     id1     = Guid.NewGuid().ToString();
            string     id2     = Guid.NewGuid().ToString();
            GameObject object1 = Object.Instantiate(m_testPrefab);

            object1.name = id1;
            GameObject object2 = Object.Instantiate(m_testPrefab);

            object2.name = id2;
            TestSavableBehaviour behaviour1 = object1.GetComponent <TestSavableBehaviour>();
            TestSavableBehaviour behaviour2 = object2.GetComponent <TestSavableBehaviour>();

            behaviour1.monobehaviourReference = behaviour2;

            var      builder  = new MockModelBuilder();
            SaveGame saveGame = SaveGamePacker.PackSaveGame(new[] { object1, object2 }, builder.GetSavableMonobehaviours());

            SerializeAndUnserialize(saveGame, builder, AllSaveablePrefabs);

            GameObject newObject1 = GameObject.Find(id1);
            GameObject newObject2 = GameObject.Find(id2);

            Assert.AreEqual(newObject2.GetComponent <TestSavableBehaviour>(),
                            newObject1.GetComponent <TestSavableBehaviour>().monobehaviourReference);
        }