예제 #1
0
        /// <summary>
        /// 载入地图数据
        /// </summary>
        /// <param name="path"></param>
        private static void LoadData(string path)
        {
            TileMapSerialize targetData = UnityEditor.AssetDatabase.LoadAssetAtPath <TileMapSerialize>(path);

            if (targetData == null)
            {
                string newPath = UnityEditor.EditorUtility.SaveFilePanelInProject("Save TileMapSerialize", "New TileMapSerialize", "asset", "Save TileMapSerialize", "Assets");

                if (newPath == "")
                {
                    return;
                }

                UnityEditor.AssetDatabase.CreateAsset(ScriptableObject.CreateInstance <TileMapSerialize>(), newPath);
                targetData = UnityEditor.AssetDatabase.LoadAssetAtPath <TileMapSerialize>(path);
            }
        }
예제 #2
0
 /// <summary>
 /// 保存json
 /// </summary>
 /// <param name="path"></param>
 /// <param name="data"></param>
 public static void SaveToJSON(string path, TileMapSerialize data)
 {
     Debug.LogFormat("Saving config to {0}", path);
     System.IO.File.WriteAllText(path, JsonUtility.ToJson(data, true));
 }