Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make package UPM compatible #3304

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions Assets/Plugins/Android.meta

This file was deleted.

143 changes: 0 additions & 143 deletions Assets/Plugins/Android/GooglePlayGamesManifest.androidlib.meta

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<dependencies>
<androidPackages>
<androidPackage spec="com.google.android.gms:play-services-games-v2:20.1.2"/>
<androidPackage spec="com.google.android.gms:play-services-nearby:19.3.0"/>
</androidPackages>
</dependencies>

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ namespace GooglePlayGames.Editor
using UnityEditor;
using UnityEngine;

#if UNITY_2021_2_OR_NEWER
using UnityEditor.Build;
#endif

/// <summary>
/// Google Play Game Services Setup dialog for Android.
/// </summary>
Expand Down Expand Up @@ -57,15 +61,14 @@ public class GPGSAndroidSetupUI : EditorWindow
/// <summary>
/// Menus the item for GPGS android setup.
/// </summary>
[MenuItem("Window/Google Play Games/Setup/Android setup...", false, 1)]
[MenuItem("Google/Play Games/Setup/Android setup...", false, 1)]
public static void MenuItemFileGPGSAndroidSetup()
{
EditorWindow window = EditorWindow.GetWindow(
typeof(GPGSAndroidSetupUI), true, GPGSStrings.AndroidSetup.Title);
var window = EditorWindow.GetWindow<GPGSAndroidSetupUI>(true, GPGSStrings.AndroidSetup.Title);
window.minSize = new Vector2(500, 400);
}

[MenuItem("Window/Google Play Games/Setup/Android setup...", true)]
[MenuItem("Google/Play Games/Setup/Android setup...", true)]
public static bool EnableAndroidMenuItem()
{
#if UNITY_ANDROID
Expand Down Expand Up @@ -111,8 +114,6 @@ public static bool PerformSetup(
// check the bundle id and set it if needed.
CheckBundleId();

GPGSUtil.CheckAndFixDependencies();
GPGSUtil.CheckAndFixVersionedAssestsPaths();
AssetDatabase.Refresh();

Google.VersionHandler.VerboseLoggingEnabled = true;
Expand Down Expand Up @@ -196,7 +197,7 @@ public static bool PerformSetup(string webClientId, string appId, string nearbyS
}

// Generate AndroidManifest.xml
GPGSUtil.GenerateAndroidManifest();
GPGSUtil.UpdateGameInfo();

// refresh assets, and we're done
AssetDatabase.Refresh();
Expand Down Expand Up @@ -298,9 +299,8 @@ public void OnGUI()
}
catch (Exception e)
{
GPGSUtil.Alert(
GPGSStrings.Error,
"Invalid classname: " + e.Message);
GPGSUtil.Alert(GPGSStrings.Error,"Invalid classname: " + e.Message);
Debug.LogException(e);
}
}

Expand Down Expand Up @@ -355,48 +355,45 @@ public static void CheckBundleId()
string packageName = GPGSProjectSettings.Instance.Get(
GPGSUtil.ANDROIDBUNDLEIDKEY, string.Empty);
string currentId;
#if UNITY_5_6_OR_NEWER
currentId = PlayerSettings.GetApplicationIdentifier(
BuildTargetGroup.Android);
#if UNITY_2021_2_OR_NEWER
currentId = PlayerSettings.GetApplicationIdentifier(NamedBuildTarget.Android);
#elif UNITY_5_6_OR_NEWER
currentId = PlayerSettings.GetApplicationIdentifier(BuildTargetGroup.Android);
#else
currentId = PlayerSettings.bundleIdentifier;
#endif
if (!string.IsNullOrEmpty(packageName))
if (string.IsNullOrEmpty(packageName))
{
if (string.IsNullOrEmpty(currentId) ||
currentId == "com.Company.ProductName")
{
#if UNITY_5_6_OR_NEWER
PlayerSettings.SetApplicationIdentifier(
BuildTargetGroup.Android, packageName);
Debug.Log("NULL package!!");
}
else if (string.IsNullOrEmpty(currentId) || currentId == "com.Company.ProductName")
{
#if UNITY_2021_2_OR_NEWER
PlayerSettings.SetApplicationIdentifier(NamedBuildTarget.Android, packageName);
#elif UNITY_5_6_OR_NEWER
PlayerSettings.SetApplicationIdentifier(BuildTargetGroup.Android, packageName);
#else
PlayerSettings.bundleIdentifier = packageName;
PlayerSettings.bundleIdentifier = packageName;
#endif
}
else if (currentId != packageName)
}
else if (currentId != packageName)
{
if (EditorUtility.DisplayDialog(
"Set Bundle Identifier?",
"The server configuration is using " + packageName +
", but the player settings is set to " + currentId +
".\nSet the Bundle Identifier to " + packageName + "?",
"OK", "Cancel"))
{
if (EditorUtility.DisplayDialog(
"Set Bundle Identifier?",
"The server configuration is using " +
packageName + ", but the player settings is set to " +
currentId + ".\nSet the Bundle Identifier to " +
packageName + "?",
"OK",
"Cancel"))
{
#if UNITY_5_6_OR_NEWER
PlayerSettings.SetApplicationIdentifier(
BuildTargetGroup.Android, packageName);
#if UNITY_2021_2_OR_NEWER
PlayerSettings.SetApplicationIdentifier(NamedBuildTarget.Android, packageName);
#elif UNITY_5_6_OR_NEWER
PlayerSettings.SetApplicationIdentifier(BuildTargetGroup.Android, packageName);
#else
PlayerSettings.bundleIdentifier = packageName;
PlayerSettings.bundleIdentifier = packageName;
#endif
}
}
}
else
{
Debug.Log("NULL package!!");
}
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,29 +21,26 @@ namespace GooglePlayGames.Editor

public class GPGSDocsUI
{
[MenuItem("Window/Google Play Games/Documentation/Plugin Getting Started Guide...", false, 100)]
[MenuItem("Google/Play Games/Documentation/Plugin Getting Started Guide...", false, 100)]
public static void MenuItemGettingStartedGuide()
{
Application.OpenURL(GPGSStrings.ExternalLinks.GettingStartedGuideURL);
}

[MenuItem("Window/Google Play Games/Documentation/Google Play Games API...", false, 101)]
[MenuItem("Google/Play Games/Documentation/Google Play Games API...", false, 101)]
public static void MenuItemPlayGamesServicesAPI()
{
Application.OpenURL(GPGSStrings.ExternalLinks.PlayGamesServicesApiURL);
}

[MenuItem("Window/Google Play Games/About/About the Plugin...", false, 300)]
[MenuItem("Google/Play Games/About/About the Plugin...", false, 300)]
public static void MenuItemAbout()
{
string msg = GPGSStrings.AboutText +
PluginVersion.VersionString + " (" +
string.Format("0x{0:X8}", GooglePlayGames.PluginVersion.VersionInt) + ")";
EditorUtility.DisplayDialog(GPGSStrings.AboutTitle, msg,
GPGSStrings.Ok);
string msg = GPGSStrings.AboutText + PluginVersion.VersionString + " (" + string.Format("0x{0:X8}", GooglePlayGames.PluginVersion.VersionInt) + ")";
EditorUtility.DisplayDialog(GPGSStrings.AboutTitle, msg, GPGSStrings.Ok);
}

[MenuItem("Window/Google Play Games/About/License...", false, 301)]
[MenuItem("Google/Play Games/About/License...", false, 301)]
public static void MenuItemLicense()
{
EditorUtility.DisplayDialog(GPGSStrings.LicenseTitle, GPGSStrings.LicenseText,
Expand Down
Loading