internal MaterialMetaData[] FindAllMaterials()
        {
            List <MaterialMetaData> metaData = new List <MaterialMetaData>();

            string[] prefabGUIDs = AssetDatabase.FindAssets("t:material", new[] { ProjectFolder });
            foreach (string guid in prefabGUIDs)
            {
                string   assetPath = AssetDatabase.GUIDToAssetPath(guid);
                Material asset     = AssetDatabase.LoadAssetAtPath <Material>(assetPath);

                string           dataPath = assetPath.Replace(".mat", ".asset");
                MaterialMetaData data     = AssetDatabase.LoadAssetAtPath <MaterialMetaData>(dataPath);

                if (data == null)
                {
                    data            = ScriptableObject.CreateInstance <MaterialMetaData>();
                    data.m_Material = asset;
                    data.name       = asset.name;
                    AssetDatabase.CreateAsset(data, dataPath);
                }

                metaData.Add(data);
            }

            AssetDatabase.SaveAssets();

            return(metaData.ToArray());
        }
 public MetaDataOptionData(MaterialMetaData data)
 {
     this.data = data;
     text      = data.name;
 }