public static void Show(VisualElement root)
        {
            if (instance == null)
            {
                instance = new PackageAddFromUrlField();
            }
            if (instance.parent == null)
            {
                root.Add(instance);
            }

            instance.Show();
        }
示例#2
0
        private void SetupAddMenu()
        {
            AddMenu.menu.AppendAction("Add package from disk...", a =>
            {
                var path = EditorUtility.OpenFilePanelWithFilters("Select package on disk", "", new[] { "package.json file", "json" });
                if (!string.IsNullOrEmpty(path) && !Package.AddRemoveOperationInProgress)
                {
                    Package.AddFromLocalDisk(path);
                }
            }, a => DropdownMenuAction.Status.Normal);

            AddMenu.menu.AppendAction("Add package from git URL...", a =>
            {
                PackageAddFromUrlField.Show(parent);
            }, a => DropdownMenuAction.Status.Normal);
        }