Search Unity

Unable to Add Git package (Solved)

Discussion in 'Package Manager' started by ThatHomelessGuy, Aug 4, 2022.

  1. ThatHomelessGuy

    ThatHomelessGuy

    Joined:
    Jun 28, 2010
    Posts:
    348
    So I've been trying to install a git package for networking and it is giving me multiple errors when I try. The errors for the package url "https://github.com/Unity-Technologi...kages/com.unity.multiplayer.samples.coop#main" are as follows.

    [Package Manager Window] Cannot perform upm operation: Unable to add package [https://github.com/Unity-Technologi...kages/com.unity.multiplayer.samples.coop#main ]:
    Error when executing git command. fatal: invalid refspec 'main '
    [NotFound].
    UnityEditor.EditorApplication:Internal_CallUpdateFunctions ()

    And

    [Package Manager Window] Error adding package: https://github.com/Unity-Technologi...kages/com.unity.multiplayer.samples.coop#main .
    UnityEditor.EditorApplication:Internal_CallUpdateFunctions ()



    I have tried googling about but either get solutions for Git pull using Git itself or similar but seemingly unrelated issues in Unity. I have restarted the hub and Unity and even my PC. I have successfully installed the packages "com.unity.netcode.gameobjects" "https://github.com/VeriorPies/ParrelSync.git?path=/ParrelSync" successfully and am wondering if the issue is something I've done or if the specific url for the failed package install is due to the target git or URL. I apologise for my ignorance I don't have much experience using Git.
     
    sakrapeetaweesri likes this.
  2. Justin22222

    Justin22222

    Joined:
    Aug 1, 2022
    Posts:
    1
    I am also having this exact issue. Please help!
     
    ThatHomelessGuy likes this.
  3. ThatHomelessGuy

    ThatHomelessGuy

    Joined:
    Jun 28, 2010
    Posts:
    348
    I found a solution.
    Navigate to "[Project root]/packages" and open the Manifest.json file in Notepad++ or desired editor.
    Under dependencies add

    "com.unity.multiplayer.samples.coop": "https://github.com/Unity-Technologi...kages/com.unity.multiplayer.samples.coop#main",

    Save it and then start unity. It might fail the first time or two and might give some yellow warnings. If it does restart and they'll go away.

    Problem solved.
     
    rikrdo000 likes this.
  4. JuanNeyraAlonzo

    JuanNeyraAlonzo

    Joined:
    Jan 10, 2019
    Posts:
    2
    Hi
    Hi I got an error trying this solution, "An error occurred while resolving packages: project has invalid dependencies:"
     
  5. BradenCFieber

    BradenCFieber

    Joined:
    Jan 3, 2021
    Posts:
    1
    I am also getting this problem, I can't add it via Git url or Manifest.json
     
  6. Pepsyx3

    Pepsyx3

    Joined:
    Jan 25, 2022
    Posts:
    2
    hay, i dont know if some still have this issue(i had),
    but it worked for me this way:
    downloaded the zip-file,
    extracted it
    and after that add it manually via"Package Manager/Add/Add Package from disk",

    the desired package showed then up in the "Packages: In Project" filtered tab.
     
  7. maximeb_unity

    maximeb_unity

    Unity Technologies

    Joined:
    Mar 20, 2018
    Posts:
    556
    Hi everyone,

    If there are trailing spaces in the string (Git URL, file path...) that you paste in the project manifest, it will not work. This might be the issue for some of you. For instance, trying to add
    "https://github.com/Unity-Technologies/com.unity.multiplayer.samples.coop.git?path=/Packages/com.unity.multiplayer.samples.coop#main "
    (without quotes) will definitely not work, but trying to add
    "https://github.com/Unity-Technologies/com.unity.multiplayer.samples.coop.git?path=/Packages/com.unity.multiplayer.samples.coop#main"
    (without quotes) should work.

    Newer versions of the Editor trim these strings when you add them via the Package Manager window (at least 2022.1 and newer; I think 2021.3 and older still do not and would fail with the "invalid dependency" error message). However, anytime you directly alter the manifest.json file, whatever is added there is taken as-is.
     
    OmarVector and m0guz like this.
  8. hamzaoy

    hamzaoy

    Joined:
    Sep 23, 2018
    Posts:
    1
    you must do the simple step:
    1- create a new script and name it "ClientNetworkTransform "
    2- past this script on ClientNetworkTransform =>

    using Unity.Netcode.Components;
    using UnityEngine;

    namespace Unity.Multiplayer.Samples.Utilities.ClientAuthority
    {
    /// <summary>
    /// Used for syncing a transform with client side changes. This includes host. Pure server as owner isn't supported by this. Please use NetworkTransform
    /// for transforms that'll always be owned by the server.
    /// </summary>
    [DisallowMultipleComponent]
    public class ClientNetworkTransform : NetworkTransform
    {
    /// <summary>
    /// Used to determine who can write to this transform. Owner client only.
    /// This imposes state to the server. This is putting trust on your clients. Make sure no security-sensitive features use this transform.
    /// </summary>
    protected override bool OnIsServerAuthoritative()
    {
    return false;
    }
    }
    }


    and it will work.
     
    Chmyke, RuneSton and sakrapeetaweesri like this.
  9. LoveCod

    LoveCod

    Joined:
    Dec 22, 2022
    Posts:
    1
    Thankyou
     
  10. SmartisticGames

    SmartisticGames

    Joined:
    Jun 8, 2014
    Posts:
    8
  11. moosesnWoop

    moosesnWoop

    Joined:
    Sep 12, 2019
    Posts:
    12

    I followed this and it was a work around. This is after installing git, adding it to the system variables Path etc. and restarted Unity - which still failed, this above solution worked.
     
  12. greensearch

    greensearch

    Joined:
    Nov 15, 2021
    Posts:
    4
    This is work !! thanks

    You have to use this path folder path\com.unity.multiplayer.samples.coop-2.0.4\Packages\com.unity.multiplayer.samples.coop\package.json
     
    harshrajani, ali12000 and inahs132 like this.
  13. kodyreed320

    kodyreed320

    Joined:
    Aug 9, 2023
    Posts:
    1
    Honestly. a LIFE SAVER i was about to give up and i saw this and it worked. so much help like thank you so so so much
     
  14. SahithJ

    SahithJ

    Joined:
    Aug 20, 2023
    Posts:
    1
    i tried adding package.json file from disk in package manager it still shows error
     
  15. ZainabCheema

    ZainabCheema

    Joined:
    Jul 26, 2023
    Posts:
    1
    Same Issue
     
  16. Starbox

    Starbox

    Joined:
    Sep 17, 2014
    Posts:
    470
    In the case of people having issues installing the In App Review package from Google's official Github account, here's what you may try.

    Check the error messages, they probably tell you you're lacking some packages, for example:
    • com.google.play.common@1.8.1
    • com.google.play.core@1.8.1
    • com.google.android.appbundle@1.9.0
    • etc.
    So, before anything else, verify that your project is linked to a Unity Project ID. That might be optional but it doesn't take much to set this up properly. Then make sure you use a correct Project Keystore and same for the Project (game) Key, unless you use a temporary debug one. That may sound weird but since dependencies are involved and somehow related to the installing of these packages, it's known that fetching dependencies does not to work properly when not using a legitimate key. Reasons: popcorn and glitter.

    Then, go grab the git URL for the app bundle and install the package, go the Unity Package Manager, then press the top left button [+] > add from (git) URL. To copy the URL, press the green button CODE and copy the Git URL.
    https://github.com/google-unity/android-app-bundle
    This in theory should work without issue. This allows you to install Play Common next.
    https://github.com/google-unity/google-play-common
    Next step is to install the Dependency Manager package.
    https://github.com/google-unity/external-dependency-manager
    You may have already installed it in your Assets, so you could expect a collision there with conflicting resources (errors: multiple assemblies wah wah). One has to go and it's the dependencies manager that you have in Assets.
    Then install Play Core:
    https://github.com/google-unity/google-play-core
    After you have obtained these four packages, you can install In App Review:
    https://github.com/google-unity/in-app-review
    You're good to go.
     
    Last edited: Sep 5, 2023
  17. harshrajani

    harshrajani

    Joined:
    Sep 12, 2023
    Posts:
    1

    like really you got my respect bro, it,s worked
     
  18. kamlakshksingh

    kamlakshksingh

    Joined:
    Jun 22, 2021
    Posts:
    2
    thanks a lot!!, I was facing the same issue, but now it's solved!
     
  19. riteshkaashyap456

    riteshkaashyap456

    Joined:
    Jun 23, 2023
    Posts:
    2
    I tried using restarting the system and it worked for me
     
  20. a179902

    a179902

    Joined:
    Feb 7, 2024
    Posts:
    1
    i used this and it works!! thank youu savior!!
     
  21. unity_7BD88DB5C704034C93C0

    unity_7BD88DB5C704034C93C0

    Joined:
    Jan 9, 2024
    Posts:
    11
    [Package Manager Window] Error adding package: https://github.com/appodeal/appodeal-unity-plugin-upm.git#v3.2.1.
    Unable to add package [https://github.com/appodeal/appodeal-unity-plugin-upm.git#v3.2.1]:
    Package com.appodeal.mediation@https://github.com/appodeal/appodeal-unity-plugin-upm.git#v3.2.1 has invalid dependencies or related test packages:
    com.google.external-dependency-manager (dependency): Package [com.google.external-dependency-manager@1.2.175] cannot be found
    UnityEditor.EditorApplication:Internal_CallUpdateFunctions ()
     
  22. AnonymousBaka

    AnonymousBaka

    Joined:
    Mar 11, 2024
    Posts:
    1
    Same.. Did u solve it???