playgameservices / play-games-plugin-for-unity

Google Play Games plugin for Unity
Other
3.47k stars 966 forks source link

Not working with Unity 6 (Can't resolve dependencies) #3313

Open serginian opened 3 months ago

serginian commented 3 months ago

Describe the bug Not working with Unity 6. Can't resolve dependencies

To Reproduce Steps to reproduce the behavior:

  1. Create any new project from templates or empty one using latest Unity 6 version.
  2. Install Google Play Games plugin
  3. Switch to Android
  4. Try Resolve dependencies

Expected behavior Dependencies should be resolved.

Observed behavior Gradle can't find a package to resolve dependencies

Versions

Additional context n\a

hippogamesunity commented 2 months ago

+1

ntngamedev commented 2 months ago

+1

j1mmie commented 1 month ago

This package is broken for me in Unity 6000.0.23f1 LTS. I found an alternative that works with Unity 6 though.

Thaina/play-games-plugin-for-unity extends this repository by making it available on UPM. Much easier to work with.

To migrate, I essentially uninstalled the Play Games Plugin for Unity and started from scratch using Thaina's method.

In my Player / Publishing Settings, I unchecked all of the Build checkboxes (Custom Main Gradle Template, Custom Gradle Properties Template, and so on)

Upon first build, Unity asks if you want to migrate your gradle templates. I selected yes. This will automatically modify the gradle templates, and check their checkboxes in Player / Publishing Settings for you.

Then I checked Custom Proguard File and added the entries recommended here: https://github.com/playgameservices/play-games-plugin-for-unity/blob/master/scripts/proguard.txt

Shoutout @Thaina for making this happen! Now my team can upgrade to Unity 6 and avoid paying $6000 to remove the freaking Unity logo

ohyouknow24 commented 1 month ago

Here is what worked for me: https://discussions.unity.com/t/game-play-services-resolver-bug-still-in-unity-6-sdk-34-35-found-workaround-temp-solution/1538619/3

But I'll paste it below as well. I've spent the last week trying to find some sort of solution so this temp fix works for me, for now until Unity/Google gets their ish together:

Ok found a workaround temp fix. @unity needs to resolve this matter but here is the workaround that just worked for me. I have two projects of my game, one in unity 6 and one In unity 2023. Install the same plugin in both, so for me that was 10.14. Go to the 2023 (or older) stable version where force resolver works no problem. So what you do is after force resolve, look in Assets\Plugins\Android. You’ll see dozens of plug-ins. Reveal that plugin folder in finder. Now go back to Unity 6. Make sure your android setup (window> google play games) is done, then go to external dependency and do a regular resolve, not a force. Because of the bug, there should be no plug-ins in there, and if there is, delete whatever is in there except GooglePlayGamesManifest. Reveal that folder in finder. Now copy everything in the 2023 plug in folder and paste it into the unity 6 plug in folder. If it asks to replace certain files, click replace. Come back to unity 6, all the plug ins should now be in there.

DO NOT FORCE RESOLVE - DO NOT REGULAR RESOLVE - DO NOT DO THE GOOGLE PLAY GAMES ANDROID SET UP - DO NOT BUILD AND RUN - DO NOT DO ANYTHING NOW EXCEPT THIS

  1. Make sure your publisher settings and player settings, etc are how you want it to be for the build. SDK MINIMUM SHOULD BE API 26 and set target to 35. You must set min to 26 or it will crash.
  2. DO NOT BUILD & RUN - if you do, it will remove the plug ins and you’ll have to copy and paste again and it will throw the Gradle error.
  3. INSTEAD do build profiles and just make a regular build FIRST. It should now successfully build it out without the Gradle issue (no clue why)
  4. NOW, after it successfully built it, press build and run and it’ll successfully install the apk onto your device. Again, if you do build and run first, it won’t do a successful build.

ALSO - ANOTHER SUGGESTION For the time being I would uncheck “enable auto-resolution” and “enable resolution on build” in the external dependency android resolver settings. If you don’t disable these two, every time you close and open your project, you’ll have to copy and paste the plug ins again. You also don’t need to do the android setup anymore either, it’s already set and if you do that, you’ll have to once again copy and paste the plug-ins.

This is my temporary fix for now. Unity, please figure out what’s going on. Hope this helps someone else

pacolaf commented 1 month ago

I've finally made it work!

Here are the steps I followed to get Google Play Games working with my Unity 6000.0.23f1 project:

  1. Installed the Google Play Games Unity Plugin 0.11.01. After that, Android dependency resolution will fail because of the default included EDM4U version (1.2.169).
  2. Installed EDM4U 1.2.183. Now, the Android dependency resolution is working properly.
  3. Modified the "/Assets/Plugins/Android/settingsTemplate.gradle" file as follows:

Before:

        maven {
            url (unityProjectPath + "/Assets/GooglePlayGames/com.google.play.games/Editor/m2repository") // Assets/GooglePlayGames/com.google.play.games/Editor/GooglePlayGamesPluginDependencies.xml:11
        }

After:

        maven {
            url (unityProjectPath + "/Assets/GeneratedLocalRepo/GooglePlayGames/com.google.play.games/Editor/m2repository") // Assets/GooglePlayGames/com.google.play.games/Editor/GooglePlayGamesPluginDependencies.xml:11
        }

I hope this information is useful for those who have the same issue.

karthikeyan9952 commented 1 month ago

I've finally made it work!

Here are the steps I followed to get Google Play Games working with my Unity 6000.0.23f1 project:

  1. Installed the Google Play Games Unity Plugin 0.11.01. After that, Android dependency resolution will fail because of the default included EDM4U version (1.2.169).
  2. Installed EDM4U 1.2.183. Now, the Android dependency resolution is working properly.
  3. Modified the "/Assets/Plugins/Android/settingsTemplate.gradle" file as follows:

Before:

        maven {
            url (unityProjectPath + "/Assets/GooglePlayGames/com.google.play.games/Editor/m2repository") // Assets/GooglePlayGames/com.google.play.games/Editor/GooglePlayGamesPluginDependencies.xml:11
        }

After:

        maven {
            url (unityProjectPath + "/Assets/GeneratedLocalRepo/GooglePlayGames/com.google.play.games/Editor/m2repository") // Assets/GooglePlayGames/com.google.play.games/Editor/GooglePlayGamesPluginDependencies.xml:11
        }

I hope this information is useful for those who have the same issue.

Thanks. It really works

cuinc commented 1 week ago

I've finally made it work!

Here are the steps I followed to get Google Play Games working with my Unity 6000.0.23f1 project:

  1. Installed the Google Play Games Unity Plugin 0.11.01. After that, Android dependency resolution will fail because of the default included EDM4U version (1.2.169).
  2. Installed EDM4U 1.2.183. Now, the Android dependency resolution is working properly.
  3. Modified the "/Assets/Plugins/Android/settingsTemplate.gradle" file as follows:

Before:

        maven {
            url (unityProjectPath + "/Assets/GooglePlayGames/com.google.play.games/Editor/m2repository") // Assets/GooglePlayGames/com.google.play.games/Editor/GooglePlayGamesPluginDependencies.xml:11
        }

After:

        maven {
            url (unityProjectPath + "/Assets/GeneratedLocalRepo/GooglePlayGames/com.google.play.games/Editor/m2repository") // Assets/GooglePlayGames/com.google.play.games/Editor/GooglePlayGamesPluginDependencies.xml:11
        }

I hope this information is useful for those who have the same issue.

"GeneratedLocalRepo" is missing

pacolaf commented 1 week ago

My instructions were for version 0.11.01. Maybe you are using the latest version, 2.0.0, which was released a few days ago? According to the release notes, there are changes related to the folder structure in the assets. I haven’t had time to test the new version yet.