Esempio n. 1
0
        void OnGUI()
        {
            EditorGUILayout.LabelField("Exporter Packages", EditorStyles.toolbarButton);
            if (packageInfos != null && packageInfos.Count > 0)
            {
                Color[] colors = new Color[] { Color.white, Color.black };
                scrollPos = EditorGUILayout.BeginScrollView(scrollPos, GUILayout.Width(340), GUILayout.Height(470));
                for (int i = 0; i < packageInfos.Count; i++)
                {
                    //GUI.backgroundColor = colors[i % 2];
                    GUI.contentColor = Color.white;
                    GUILayout.BeginHorizontal();
                    EditorGUILayout.LabelField(packageInfos[i].name, EditorStyles.largeLabel);

                    if (GUILayout.Button("Export"))
                    {
                        PackageExporter.ExportPackage(packageInfos[i].assetPath, packageInfos[i].resolvedPath);
                    }
                    GUILayout.EndHorizontal();
                }
                EditorGUILayout.EndScrollView();

                this.Repaint();
            }
            else
            {
                EditorGUILayout.LabelField("Loading ...", EditorStyles.centeredGreyMiniLabel);
            }
        }
        void OnEnable()
        {
            var button = new Button(() =>
            {
                var context = new PackageExportContext("PackageExport", "Assets/Plugins/StansAssets/Test")
                {
                    AddPackageVersionPostfix = true
                };

                PackageExporter.Export("com.stansassets.package-export", context);
            });

            button.text = "Export";
            rootVisualElement.Add(button);
        }