UsedAssets.GetAllAssets C# (CSharp) Method

GetAllAssets() public static method

public static GetAllAssets ( ) : string[]
return string[]
	public static string[] GetAllAssets()
	{
		string[] tmpAssets1 = Directory.GetFiles(Application.dataPath, "*.*", SearchOption.AllDirectories);
		string[] tmpAssets2 = Array.FindAll(tmpAssets1, name => !name.EndsWith(".meta"));
		string[] allAssets;
		
		allAssets = Array.FindAll(tmpAssets2, name => !name.EndsWith(".unity"));
		
		for (int i = 0; i < allAssets.Length; i++)
		{
			allAssets[i] = allAssets[i].Substring(allAssets[i].IndexOf("/Assets") + 1);
			allAssets[i] = allAssets[i].Replace(@"\", "/");
		}
		
		return allAssets;
	}
	

Usage Example

Ejemplo n.º 1
0
    void OnGUI()
    {
        GUIStyle style = new GUIStyle();

        style.wordWrap         = true;
        style.normal.textColor = Color.white;

        GUILayout.BeginVertical();
        if (GUILayout.Button("log dupes"))
        {
            compareAssetList(UsedAssets.GetAllAssets());
            m_Init = true;
        }
        if (m_Init && !m_Found)
        {
            style.normal.textColor = Color.green;
            GUILayout.Label("\nNo dumplicates found :-D\n\n", style);
            style.normal.textColor = Color.white;
        }
        else if (m_Init && m_Found)
        {
            style.normal.textColor = Color.red;
            string s = "";
            foreach (string t in m_Strings)

            {
                s = s + t + "\n";
            }
            GUILayout.Label("\nduplicates found !!!\n\n" + s, style);
            style.normal.textColor = Color.white;
        }
        GUILayout.EndVertical();
    }
All Usage Examples Of UsedAssets::GetAllAssets