DataTransferer.cs 570 B

1234567891011121314151617181920212223242526
  1. using DataTools;
  2. using System;
  3. using System.Linq;
  4. using UnityEngine;
  5. public class DataTransferer : MonoBehaviour
  6. {
  7. public DataGame dataGame;
  8. public LocationsManager locMgr;
  9. private void Start()
  10. {
  11. TransferData();
  12. }
  13. public void TransferData()
  14. {
  15. Func<string, DataTools.Location> l = (string x) => { var loc = new DataTools.Location { Id = x }; return loc; };
  16. dataGame.GameData.Locations = locMgr.Locations.Select(x => l(x)).ToList();
  17. #if UNITY_EDITOR
  18. UnityEditor.EditorUtility.SetDirty(dataGame);
  19. UnityEditor.AssetDatabase.SaveAssets();
  20. #endif
  21. }
  22. }