/* * private void Save(int index) { * PlayerPrefs.SetFloat(index + "x", allBlocksTransform[index].position.x); * PlayerPrefs.SetFloat(index + "y", allBlocksTransform[index].position.y); * PlayerPrefs.SetFloat(index + "z", allBlocksTransform[index].position.z); * * Quaternion rot = allBlocksTransform[index].rotation; * * PlayerPrefs.SetFloat(index + "qx", rot.x); * PlayerPrefs.SetFloat(index + "qy", rot.y); * PlayerPrefs.SetFloat(index + "qz", rot.z); * PlayerPrefs.SetFloat(index + "qw", rot.w); * * Debug.LogWarning("Saved rotation: " + rot + " "); * }*/ private void Save(BlockSave bs, int index) { PlayerPrefs.SetFloat(index + "x", bs.position.x); PlayerPrefs.SetFloat(index + "y", bs.position.y); PlayerPrefs.SetFloat(index + "z", bs.position.z); Quaternion rot = bs.rotation; PlayerPrefs.SetFloat(index + "qx", bs.rotation.x); PlayerPrefs.SetFloat(index + "qy", bs.rotation.y); PlayerPrefs.SetFloat(index + "qz", bs.rotation.z); PlayerPrefs.SetFloat(index + "qw", bs.rotation.w); Debug.LogError(bs.rotation); }
public void SaveAllPositions() { /* * allBlocksTransform = new List<BlockSave>(); * * foreach (GameObject n in allBlocks) { * * BlockSave bS = new BlockSave(); * bS.position = n.transform.position; * bS.rotation = n.transform.rotation; * * allBlocksTransform.Add(bS); * }*/ for (int i = 0; i < allBlocks.Count; i++) { BlockSave bs = new BlockSave(); bs.position = allBlocks[i].transform.position; bs.rotation = allBlocks[i].transform.rotation; Save(bs, i); } }