예제 #1
0
        //el metodo
        void GeneratePalette()
        {
            Color32[] AllPixels = tex.GetPixels32();

            var pathname = EditorUtility.SaveFilePanelInProject("Save Palette Asset as...", "Palette_xxx", "asset", "asset");

            //string pathname = AssetDatabase.GenerateUniqueAssetPath("Assets/Resources/" + tex.name.ToString() + "_Palette" + ".asset");

            SO_Color2Prefab tempAsset = CreateInstance <SO_Color2Prefab>();

            AssetDatabase.CreateAsset(tempAsset, pathname);

            for (int i = 0; i < AllPixels.Length; i++)
            {
                tempAsset.color2prefab.Add(new Color2Prefab(AllPixels[i]));
            }
            tempAsset.Clean();

            AssetDatabase.SaveAssets();
            AssetDatabase.Refresh();
            EditorUtility.FocusProjectWindow();
        }