GithubHelp home page GithubHelp logo

shlifedev / unity-package-manager-utility Goto Github PK

View Code? Open in Web Editor NEW
7.0 2.0 0.0 24 KB

Utilities to access the PackageManager Internal API (scopes registry, dependencie, registry) in Unity.

C# 100.00%
package package-manager unity unity-editor package-registry unity-tool unityengine api

unity-package-manager-utility's Introduction

PackageManagerUtility

  • dev In this branch, removed the UniTask-specific dependencies, so all you need to do is add the editorcoroutine to your package.json to use it. If you want UniTask functionality, add the UNITASK define to your buildsettings.

The Unity Engine automatically manages your package dependencies with package.json and manifest.json.

You may need to use the functionality of UnityEditor.PackageManager to manage your own packages. However, Unity does not support a scoped registry for unknown reasons, and the API is set to Internal, so you cannot access the API in the usual way.

Therefore, I've written a hook for ScopedRegistry and will gradually update this repo to add temporary support for external registries like openupm, git, etc.

But for now, it only provides the hooks API.

Requirement

  • UniTask

How to use

You can easily access all APIs through the PackageManagerUtility.cs You will need to install unitask.

 class Example 
    {
        async UniTask YourFunction()
        {
            // You can add scoped registry with code.
            await PackageManagerUtility.AddScopeAndRegistry("openupm", "https://package.openupm.com",
                new[] { "com.shlifedev.ugs" });

            // You can get scoped registry in project
            var registires = await PackageManagerUtility.GetRegistries();
            foreach (var reg in registires)
            {
                Debug.Log("Registry : " + reg.name);
            }
            
            
            // You can get scopes and, update scopes
            var openUpmScopes = await PackageManagerUtility.GetScopes("openupm");
            // You can merging scope.
            var newScopes = PackageManagerUtility.MergeScopes(openUpmScopes, new[] { "com.cysharp.unitask" });
            // Update Registry.
            await PackageManagerUtility.UpdateScopedRegistry("openupm", "https://package.openupm.com", newScopes);
            
            
            // You can find missing dependencies and adding.
            MissingDependency[] missingDependencies = await PackageManagerUtility.GetMissingDependency();
            foreach (var missing in missingDependencies)
            {

             // but it's support only github or unity registry. if you need adding other package registry dependency then using UpdateScopedRegistry function.
                await PackageManagerUtility.AddDependency(missing);
            }
            
         
            // ... etc
        }
    }

You can import this source your project.

You can import this your project and deploy.

Thank

I reference this gist. here

unity-package-manager-utility's People

Contributors

kimchanhyung98 avatar shlifedev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.