public SceneInfo(AssetInfo sceneAssetInfo, List <AssetInfo> assets) { assetInfo = sceneAssetInfo; Scene scene = EditorSceneManager.OpenScene(assetInfo.path, OpenSceneMode.Additive); var objs = scene.GetRootGameObjects(); List <Transform> trs = new List <Transform>(1000); foreach (var obj in objs) { trs.AddRange(obj.GetComponentsInChildren <Transform>()); MyGC.CheckGC(); //break; } List <GameObjectInfo> gObjInfList = new List <GameObjectInfo>(1000); foreach (var tr in trs) { gObjInfList.Add(new GameObjectInfo(tr, this /*, assets*/)); MyGC.CheckGC(); } //только так, иначе выдаст неверные пути!!! foreach (var goInfo in gObjInfList) { goInfo.Init(assets); MyGC.CheckGC(); } gObjInfs = gObjInfList.ToArray(); EditorSceneManager.CloseScene(scene, true); }
private List <SceneInfo> InitScenes(List <AssetInfo> assets) { //int count = SceneManager.sceneCountInBuildSettings; List <SceneInfo> sceneInfoList = new List <SceneInfo>(10); //for (int i = 0; i < count; ++i) //{ // sceneInfoList.Add(new SceneInfo(i, assets)); //} Scene curScene = EditorSceneManager.GetActiveScene(); string curScenePath = curScene.path; EditorSceneManager.CloseScene(curScene, true); foreach (var asset in assets) { if (asset.extension.ToLower() == sceneExt.ToLower() //*|*|*|*|*|*|*|*|*|*|*|*|*|*|*|*|*|*|*ВЫПИЛИТЬ!!!!!*|*|*|*|*|*|*|*|*|*|*|*|*|*|*|*|*|*|* //&& asset.path == "Assets/ImportLeftAssets/RMC/Scene/DemoScene.unity" //&& asset.path == "Assets/MINECRAFT/YULIYA/minecraft_scene 2" ) { //Debug.LogError("SCEEEEEENEEEEEEEE!!!!!!!!!!!!!!"); sceneInfoList.Add(new SceneInfo(asset, assets)); MyGC.CheckGC(true); } } EditorSceneManager.OpenScene(curScenePath, OpenSceneMode.Single); return(sceneInfoList); }
private void Init() { MyGC.ResetGCLog(); var watch = System.Diagnostics.Stopwatch.StartNew(); assetList = GetAllAssets(); assetList = InitAssets(assetList); MyGC.CheckGC(true); watch.Stop(); float elapsedSec = (float)watch.Elapsed.TotalSeconds; Debug.LogError("Assets complete (" + elapsedSec + " seconds)"); watch = System.Diagnostics.Stopwatch.StartNew(); sceneList = InitScenes(assetList); assetList = CalculateAssetObjectDependencies(assetList, sceneList); FbxNamingDoublesGroups = FindFbxNamingDoubles(assetList, out FbxNamingDoublesGroupInfs); MyGC.CheckGC(true); watch.Stop(); elapsedSec = (float)watch.Elapsed.TotalSeconds; Debug.LogError("Objects complete (" + elapsedSec + " seconds)"); MyGC.LogGC(); }
private List <AssetInfo> InitAssets(List <AssetInfo> assets) { foreach (var asset in assets) { asset.FirstInitDependencies(); MyGC.CheckGC(); } var assArr = assets.ToArray(); foreach (var asset in assets) { asset.SecondInitDependencies(assArr); MyGC.CheckGC(); } return(assets); }
private List <AssetInfo> GetAllAssets() { List <AssetInfo> assets = new List <AssetInfo>(1000); string[] allAssetPathes = AssetDatabase.GetAllAssetPaths(); foreach (var path in allAssetPathes) { if (path.Contains("Assets/") && !AssetDatabase.IsValidFolder(path)) { assets.Add(new AssetInfo(path)); } MyGC.CheckGC(); } assets = assets.OrderBy(o => o.path).ToList(); return(assets); }