Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Is there a way to open Package Manager from code?

Discussion in 'Scripting' started by stevenatunity, Jun 15, 2020.

  1. stevenatunity

    stevenatunity

    Joined:
    Apr 17, 2015
    Posts:
    114
    Hi, I'm wondering if there is a way to open the Package Manager window from C# code? thanks :)
     
  2. lordofduct

    lordofduct

    Joined:
    Oct 3, 2011
    Posts:
    8,514
    You can open the window by access UnityEditor.PackageManager.UI.Window.Open.

    It expects a package name passed in as a string, but if you pass in blank it just opens with no package selected:
    Code (csharp):
    1. UnityEditor.PackageManager.UI.Window.Open("");
    Note, this isn't in my older unity 2018.4.1f1, but it is in my install of 2019.3.7f1. I don't know what version you're on and it may not be in your version.
     
  3. stevenatunity

    stevenatunity

    Joined:
    Apr 17, 2015
    Posts:
    114
    Perfect as I’m on 2019.4 :)