コード例 #1
0
        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!");
            }
        }
コード例 #2
0
        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();
            }
        }
コード例 #3
0
 public static string ToAssetPath(this FileInfo fileInfo)
 {
     return(AssetDatabaseUtility.GetPathRelativeToProjectPath(fileInfo.FullName));
 }
コード例 #4
0
 public static string ToAssetGuid(this FileInfo fileInfo)
 {
     return(AssetDatabaseUtility.GetAssetGuid(fileInfo));
 }