public void SaveScene(EntityManager entityManager, Scene scene, string path) { SaveToFile(entityManager, scene, path); using (Session.GetManager <IEditorSceneManagerInternal>().IgnoreSceneImport()) { AssetDatabase.ImportAsset(AssetDatabaseUtility.GetPathRelativeToProjectPath(path), ImportAssetOptions.ForceSynchronousImport | ImportAssetOptions.ForceUncompressedImport); } var assetGuid = AssetDatabase.AssetPathToGUID(AssetDatabaseUtility.GetPathRelativeToProjectPath(path)); if (string.IsNullOrEmpty(assetGuid)) { throw new Exception("Failed to save!"); } }
public Scene LoadScene(EntityManager entityManager, string path, bool removeRemapInfo) { var assetGuid = AssetDatabase.AssetPathToGUID(AssetDatabaseUtility.GetPathRelativeToProjectPath(path)); var world = new World(assetGuid); try { var scene = LoadFromFile(world.EntityManager, path, Session.GetManager <IAssetManager>()); entityManager.MoveEntitiesFrom(world.EntityManager); entityManager.World.GetOrCreateSystem <EntityReferenceRemapSystem>().Update(); if (removeRemapInfo) { entityManager.World.GetOrCreateSystem <RemoveRemapInformationSystem>().Update(); } return(scene); } finally { world.Dispose(); } }
public static string ToAssetPath(this FileInfo fileInfo) { return(AssetDatabaseUtility.GetPathRelativeToProjectPath(fileInfo.FullName)); }
public static string ToAssetGuid(this FileInfo fileInfo) { return(AssetDatabaseUtility.GetAssetGuid(fileInfo)); }