private static void GenerateAllSceneRenderableObjectID() { var sceneCount = SceneManager.sceneCount; for (int i = 0; i < sceneCount; ++i) { var scene = SceneManager.GetSceneAt(i); if (scene.name.Equals(String.Empty)) { continue; } if (scene.name.EndsWith(SingleScene.StreamSuffix)) { continue; } var singleScene = new SingleScene(scene.path, scene.name, Index.InValidIndex); singleScene.GeneraterRenderableObjectID(); singleScene.Save(); } }
public static bool OpenAllScenesAndGernerateGUID(string mapName) { var config = GetSceneConfig(mapName); if (string.IsNullOrEmpty(config.MapName)) { return(false); } if (config.IsStreamScene) { Util.ClearScenes(); var tiles = config.indices; var multiScene = new MultiScene(config.GetSceneAssetPath(), config.SceneNamePattern, config.TileDimension, config.TileSize); foreach (var tile in tiles) { int tileX = tile.x; int tileY = tile.y; int tileDimension = config.TileDimension; for (int x = 0; x < tileDimension; ++x) { for (int y = 0; y < tileDimension; ++y) { if (Math.Abs(x - tileX) > 1 || Math.Abs(y - tileY) > 1) { continue; } //string scenePath = string.Format("{0}/{1}.unity", config.GetSceneAssetPath(), string.Format(config.SceneNamePattern, x, y)); Util.OpenScene(config.GetSceneAssetPath(), string.Format(config.SceneNamePattern, x, y), OpenSceneMode.Single); Util.OpenScene(config.GetSceneAssetPath() + "/Streaming", string.Format(config.SceneNamePattern, x, y) + SingleScene.StreamSuffix, OpenSceneMode.Additive); SingleScene scene = new SingleScene(config.GetSceneAssetPath(), string.Format(config.SceneNamePattern, x, y), new Index(x, y), null, multiScene); scene.GeneraterRenderableObjectID(); multiScene.AddMaxGUID(x, y, scene.MaxGameObjectIDCount); } } } multiScene.Save(); } else { //string scenePath = string.Format("{0}/{1}.unity", config.GetSceneAssetPath(), config.SceneNamePattern); Util.OpenScene(config.GetSceneAssetPath(), config.SceneNamePattern, OpenSceneMode.Single); var singleScene = new SingleScene(config.GetSceneAssetPath(), config.SceneNamePattern, Index.InValidIndex); singleScene.GeneraterRenderableObjectID(); singleScene.Save(); } return(true); }