public void ModifyOrCreateAsset(GameObject AssetToSave, string DesiredPathHint, string AssetName) { if (AssetExists(AssetToSave.GetType(), AssetName)) { // re-save it String PathToAsset = m_DataAssetTree.GetPathToAsset(AssetToSave.GetType().Name, AssetName); AssetToSave.SaveXML(PathToAsset); } else { // create the file and save the asset String DesiredAssetPath = m_DataAssetTree.Root + Path.DirectorySeparatorChar + DesiredPathHint; if (!Directory.Exists(DesiredAssetPath)) { Directory.CreateDirectory(DesiredAssetPath); } String PathName = DesiredAssetPath + Path.DirectorySeparatorChar + AssetName + "." + AssetToSave.GetType().Name; AssetToSave.SaveXML(PathName); AddAssetToCache(AssetToSave.GetType(), AssetName, AssetToSave); m_DataAssetTree.AddItemToTree(PathName); } }
public void ModifyOrCreateAsset(GameObject assetToSave, string desiredPathHint, string assetName) { if (AssetExists(assetToSave.GetType(), assetName)) { // re-save it string pathToAsset = m_DataAssetTree.GetPathToAsset(assetToSave.GetType().Name, assetName); assetToSave.SaveXML(pathToAsset); } else { // create the file and save the asset string desiredAssetPath = m_DataAssetTree.Root + Path.DirectorySeparatorChar + desiredPathHint; if (!Directory.Exists(desiredAssetPath)) { Directory.CreateDirectory(desiredAssetPath); } string pathName = desiredAssetPath + Path.DirectorySeparatorChar + assetName + "." + assetToSave.GetType().Name; assetToSave.SaveXML(pathName); AddAssetToCache(assetToSave.GetType(), assetName, assetToSave); m_DataAssetTree.AddItemToTree(pathName); } }