Daikon Forge Fix
Добавлено: 01 май 2014, 14:10
Фикс актуален для любой версии, включая актуальную на сегодня 1.0.16. При более менее толстом проекте при выборе атласа в инспекторе контророла daikon forge получаем забитую оперативку полностью всем проектом(в моем случае около 3Гб). Для снижения негатива от использования фреймворка ищем класс dfPrefabSelectionDialog и меняем в нем метод getFilteredItems() на приведенный ниже. И соответственно меняем имя обьявленной коллекции allPrefabsInProject на allAtlasInProject.
Синтаксис:
Используется csharp
private List<GameObject> getFilteredItems()
{
if( allAtlasInProject == null )
{
allAtlasInProject = new List<GameObject>();
var progressTime = Environment.TickCount;
var allAssetPaths = AssetDatabase.GetAllAssetPaths();
for( int i = 0; i < allAssetPaths.Length; i++ )
{
if( Environment.TickCount - progressTime > 250 )
{
progressTime = Environment.TickCount;
EditorUtility.DisplayProgressBar( this.title, "Loading prefabs", (float)i / (float)allAssetPaths.Length );
}
var path = allAssetPaths[ i ];
if( !path.EndsWith( ".prefab", StringComparison.OrdinalIgnoreCase ) )
continue;
try
{
var go = AssetDatabase.LoadMainAssetAtPath( path ) as GameObject;
if (IsPrefab(go))
{
if (go.GetComponent(componentType) != null)
{
try
{
if (filterCallback != null && !filterCallback(go))
continue;
}
catch { continue; }
if (go.name.IndexOf(searchFilter, StringComparison.OrdinalIgnoreCase) != -1)
{
allAtlasInProject.Add(go);
}
}
}
go = null;
EditorUtility.UnloadUnusedAssets();
}
catch( Exception err )
{
Debug.LogError( "Error loading prefab at " + path + " - " + err.Message );
}
}
EditorUtility.ClearProgressBar();
allAtlasInProject.Sort( ( GameObject lhs, GameObject rhs ) =>
{
return lhs.name.CompareTo( rhs.name );
} );
}
return allAtlasInProject;
}
{
if( allAtlasInProject == null )
{
allAtlasInProject = new List<GameObject>();
var progressTime = Environment.TickCount;
var allAssetPaths = AssetDatabase.GetAllAssetPaths();
for( int i = 0; i < allAssetPaths.Length; i++ )
{
if( Environment.TickCount - progressTime > 250 )
{
progressTime = Environment.TickCount;
EditorUtility.DisplayProgressBar( this.title, "Loading prefabs", (float)i / (float)allAssetPaths.Length );
}
var path = allAssetPaths[ i ];
if( !path.EndsWith( ".prefab", StringComparison.OrdinalIgnoreCase ) )
continue;
try
{
var go = AssetDatabase.LoadMainAssetAtPath( path ) as GameObject;
if (IsPrefab(go))
{
if (go.GetComponent(componentType) != null)
{
try
{
if (filterCallback != null && !filterCallback(go))
continue;
}
catch { continue; }
if (go.name.IndexOf(searchFilter, StringComparison.OrdinalIgnoreCase) != -1)
{
allAtlasInProject.Add(go);
}
}
}
go = null;
EditorUtility.UnloadUnusedAssets();
}
catch( Exception err )
{
Debug.LogError( "Error loading prefab at " + path + " - " + err.Message );
}
}
EditorUtility.ClearProgressBar();
allAtlasInProject.Sort( ( GameObject lhs, GameObject rhs ) =>
{
return lhs.name.CompareTo( rhs.name );
} );
}
return allAtlasInProject;
}