From a4b5d74f131810c5a5f3e1fe8fc9319943f3412a Mon Sep 17 00:00:00 2001 From: Jared Marsau Date: Wed, 21 Dec 2022 15:09:09 -0800 Subject: [PATCH] Fixed a couple issues with the GameKit plug-in: - Post build script phase in native library project was no longer copying build results correctly. Updated to Xcode's built in 'Copy files' phase and removed. - Fixed an issue where title/input would freeze after displaying GameKit view for leaderboards. --- .../Assets/Apple.Core.meta | 8 ++ .../Assets/Apple.Core/Editor.meta | 8 ++ .../Editor/DefaultAppleBuildProfile.asset | 97 +++++++++++++++++ .../DefaultAppleBuildProfile.asset.meta | 8 ++ .../Assets/Apple.GameKit/CHANGELOG.md | 6 ++ .../Assets/Apple.GameKit/package.json | 2 +- .../GameKitWrapper.xcodeproj/project.pbxproj | 101 +++++++----------- .../GKGameCenterViewController.swift | 1 + 8 files changed, 169 insertions(+), 62 deletions(-) create mode 100644 plug-ins/Apple.GameKit/Apple.GameKit_Unity/Assets/Apple.Core.meta create mode 100644 plug-ins/Apple.GameKit/Apple.GameKit_Unity/Assets/Apple.Core/Editor.meta create mode 100644 plug-ins/Apple.GameKit/Apple.GameKit_Unity/Assets/Apple.Core/Editor/DefaultAppleBuildProfile.asset create mode 100644 plug-ins/Apple.GameKit/Apple.GameKit_Unity/Assets/Apple.Core/Editor/DefaultAppleBuildProfile.asset.meta diff --git a/plug-ins/Apple.GameKit/Apple.GameKit_Unity/Assets/Apple.Core.meta b/plug-ins/Apple.GameKit/Apple.GameKit_Unity/Assets/Apple.Core.meta new file mode 100644 index 00000000..d5ffbf65 --- /dev/null +++ b/plug-ins/Apple.GameKit/Apple.GameKit_Unity/Assets/Apple.Core.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b008595ca622b4ff094b277db8c4713b +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/plug-ins/Apple.GameKit/Apple.GameKit_Unity/Assets/Apple.Core/Editor.meta b/plug-ins/Apple.GameKit/Apple.GameKit_Unity/Assets/Apple.Core/Editor.meta new file mode 100644 index 00000000..6aaa0cc7 --- /dev/null +++ b/plug-ins/Apple.GameKit/Apple.GameKit_Unity/Assets/Apple.Core/Editor.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 60ef6f71a991443d4b58c3652e421bbd +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/plug-ins/Apple.GameKit/Apple.GameKit_Unity/Assets/Apple.Core/Editor/DefaultAppleBuildProfile.asset b/plug-ins/Apple.GameKit/Apple.GameKit_Unity/Assets/Apple.Core/Editor/DefaultAppleBuildProfile.asset new file mode 100644 index 00000000..21d779d6 --- /dev/null +++ b/plug-ins/Apple.GameKit/Apple.GameKit_Unity/Assets/Apple.Core/Editor/DefaultAppleBuildProfile.asset @@ -0,0 +1,97 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &-6450165528288752212 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe2e2f0820ab4779ac857f0e06bac5fb, type: 3} + m_Name: AppleUserManagementBuildStep + m_EditorClassIdentifier: + IsEnabled: 0 + AllowGetCurrentUser: 0 + AllowRunsAsCurrentUser: 0 +--- !u!114 &-2574758401583084156 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 88a319fb99484804b632ce9bbec4cf6d, type: 3} + m_Name: AppleSecurityBuildStep + m_EditorClassIdentifier: + IsEnabled: 1 + AppSandboxEntitlement: 1 + AllowNetworkServer: 0 + AllowNetworkClient: 0 + AllowCamera: 0 + AllowMicrophone: 0 + AllowUsb: 0 + AllowPrint: 0 + AllowBluetooth: 0 + AllowAddressBook: 0 + AllowLocation: 0 + AllowCalendars: 0 + AllowUserSelectedReadOnly: 0 + AllowUserSelectedReadWrite: 0 + AllowDownloadsReadOnly: 0 + AllowDownloadsReadWrite: 0 + AllowPicturesReadOnly: 0 + AllowPicturesReadWrite: 0 + AllowMusicReadOnly: 0 + AllowMusicReadWrite: 0 + AllowMoviesReadOnly: 0 + AllowMoviesReadWrite: 0 +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 6b2797781d18e4c5987f2acb206f9e7b, type: 3} + m_Name: DefaultAppleBuildProfile + m_EditorClassIdentifier: + AutomateInfoPlist: 1 + DefaultInfoPlist: {fileID: 0} + MinimumOSVersion_iOS: + MinimumOSVersion_tvOS: + MinimumOSVersion_macOS: + AppUsesNonExemptEncryption: 0 + AutomateEntitlements: 1 + DefaultEntitlements: {fileID: 0} +--- !u!114 &3595795138729071060 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 24e6011bb95664520aa4858e4c359e06, type: 3} + m_Name: AppleGameKitBuildStep + m_EditorClassIdentifier: + IsEnabled: 1 +--- !u!114 &5727258473835731888 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: c6b8a8fe473224decaaecc9264d56e95, type: 3} + m_Name: AppleCoreBuildStep + m_EditorClassIdentifier: + IsEnabled: 1 diff --git a/plug-ins/Apple.GameKit/Apple.GameKit_Unity/Assets/Apple.Core/Editor/DefaultAppleBuildProfile.asset.meta b/plug-ins/Apple.GameKit/Apple.GameKit_Unity/Assets/Apple.Core/Editor/DefaultAppleBuildProfile.asset.meta new file mode 100644 index 00000000..377b0642 --- /dev/null +++ b/plug-ins/Apple.GameKit/Apple.GameKit_Unity/Assets/Apple.Core/Editor/DefaultAppleBuildProfile.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 6fee571abd87347d6a0f39087d93aca5 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/plug-ins/Apple.GameKit/Apple.GameKit_Unity/Assets/Apple.GameKit/CHANGELOG.md b/plug-ins/Apple.GameKit/Apple.GameKit_Unity/Assets/Apple.GameKit/CHANGELOG.md index d6c281ef..db842f0e 100644 --- a/plug-ins/Apple.GameKit/Apple.GameKit_Unity/Assets/Apple.GameKit/CHANGELOG.md +++ b/plug-ins/Apple.GameKit/Apple.GameKit_Unity/Assets/Apple.GameKit/CHANGELOG.md @@ -1,6 +1,12 @@ # CHANGELOG All notable changes to this project will be documented in this file. +## [1.0.4] - 2022-12-21 +### Changed +- Post build script phase of native library project was failing to correctly copy libraries; updated to use Xcode's built in 'copy files' phase. +### Fixed +- Fixed an issue in which app would freeze/become unresponsible after viewing and closing leaderboards. + ## [1.0.3] - 2022-11-29 ### Changed - Disabled bitcode generation in all native library project build targets. diff --git a/plug-ins/Apple.GameKit/Apple.GameKit_Unity/Assets/Apple.GameKit/package.json b/plug-ins/Apple.GameKit/Apple.GameKit_Unity/Assets/Apple.GameKit/package.json index d23a3b7d..a1589deb 100644 --- a/plug-ins/Apple.GameKit/Apple.GameKit_Unity/Assets/Apple.GameKit/package.json +++ b/plug-ins/Apple.GameKit/Apple.GameKit_Unity/Assets/Apple.GameKit/package.json @@ -2,7 +2,7 @@ "name": "com.apple.unityplugin.gamekit", "displayName": "Apple.GameKit", "description": "Exposes Apple's GameKit.framework to Unity developers via C# script API", - "version": "1.0.3", + "version": "1.0.4", "unity": "2019.4", "dependencies": { "com.apple.unityplugin.core": "1.0.2" diff --git a/plug-ins/Apple.GameKit/Native/GameKitWrapper.xcodeproj/project.pbxproj b/plug-ins/Apple.GameKit/Native/GameKitWrapper.xcodeproj/project.pbxproj index 34a36358..c17d8046 100644 --- a/plug-ins/Apple.GameKit/Native/GameKitWrapper.xcodeproj/project.pbxproj +++ b/plug-ins/Apple.GameKit/Native/GameKitWrapper.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 54; + objectVersion = 50; objects = { /* Begin PBXAggregateTarget section */ @@ -23,6 +23,9 @@ /* End PBXAggregateTarget section */ /* Begin PBXBuildFile section */ + 249884252953BCD6003E9DB7 /* GameKitWrapper.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 7A9B815324A4FC3800FB2FE8 /* GameKitWrapper.framework */; }; + 249884272953C081003E9DB7 /* GameKitWrapper.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 7AE5BBA22502C0DD00BDBEDA /* GameKitWrapper.framework */; }; + 249884292953C09D003E9DB7 /* GameKitWrapper.bundle in CopyFiles */ = {isa = PBXBuildFile; fileRef = 7A7E439624B508D40086FB7A /* GameKitWrapper.bundle */; }; 7A3E81F726F27BD800B102BB /* GKNotificationBanner.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A3E81F626F27BD800B102BB /* GKNotificationBanner.swift */; }; 7A3E81F826F27BD800B102BB /* GKNotificationBanner.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A3E81F626F27BD800B102BB /* GKNotificationBanner.swift */; }; 7A3E81F926F27BD800B102BB /* GKNotificationBanner.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7A3E81F626F27BD800B102BB /* GKNotificationBanner.swift */; }; @@ -163,6 +166,39 @@ }; /* End PBXContainerItemProxy section */ +/* Begin PBXCopyFilesBuildPhase section */ + 249884242953BCA5003E9DB7 /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = "$(PROJECT_DIR)/../Apple.GameKit_Unity/Assets/Apple.GameKit/Plugins/iOS"; + dstSubfolderSpec = 0; + files = ( + 249884252953BCD6003E9DB7 /* GameKitWrapper.framework in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 249884262953C066003E9DB7 /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = "$(PROJECT_DIR)/../Apple.GameKit_Unity/Assets/Apple.GameKit/Plugins/tvOS"; + dstSubfolderSpec = 0; + files = ( + 249884272953C081003E9DB7 /* GameKitWrapper.framework in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 249884282953C08D003E9DB7 /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = "$(PROJECT_DIR)/../Apple.GameKit_Unity/Assets/Apple.GameKit/Plugins/macOS"; + dstSubfolderSpec = 0; + files = ( + 249884292953C09D003E9DB7 /* GameKitWrapper.bundle in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + /* Begin PBXFileReference section */ 46531AD89A1A23DEFB9D6429 /* libPods-GameKitWrapperUnitTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-GameKitWrapperUnitTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 7A3E81F626F27BD800B102BB /* GKNotificationBanner.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GKNotificationBanner.swift; sourceTree = ""; }; @@ -353,7 +389,7 @@ 7A7E439224B508D40086FB7A /* Sources */, 7A7E439324B508D40086FB7A /* Frameworks */, 7A7E439424B508D40086FB7A /* Resources */, - 7AB16546256D803900582D43 /* ShellScript */, + 249884282953C08D003E9DB7 /* CopyFiles */, ); buildRules = ( ); @@ -372,7 +408,7 @@ 7A9B814F24A4FC3800FB2FE8 /* Sources */, 7A9B815024A4FC3800FB2FE8 /* Frameworks */, 7A9B815124A4FC3800FB2FE8 /* Resources */, - 7AB1653B256D7FB500582D43 /* ShellScript */, + 249884242953BCA5003E9DB7 /* CopyFiles */, ); buildRules = ( ); @@ -391,7 +427,7 @@ 7AE5BB8C2502C0DD00BDBEDA /* Sources */, 7AE5BB9D2502C0DD00BDBEDA /* Frameworks */, 7AE5BB9E2502C0DD00BDBEDA /* Resources */, - 7AB16542256D802200582D43 /* ShellScript */, + 249884262953C066003E9DB7 /* CopyFiles */, ); buildRules = ( ); @@ -469,63 +505,6 @@ }; /* End PBXResourcesBuildPhase section */ -/* Begin PBXShellScriptBuildPhase section */ - 7AB1653B256D7FB500582D43 /* ShellScript */ = { - isa = PBXShellScriptBuildPhase; - alwaysOutOfDate = 1; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - ); - outputFileListPaths = ( - ); - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "# Remove and copy fresh build...\nrm -rf \"${PROJECT_DIR}/../Apple.GameKit_Unity/Assets/Apple.GameKit/Plugins/iOS/GameKitWrapper.framework\"\ncp -f -R \"${BUILT_PRODUCTS_DIR}/${APPLICATION_NAME}/GameKitWrapper.framework\" \"${PROJECT_DIR}/../Apple.GameKit_Unity/Assets/Apple.GameKit/Plugins/iOS/\"\n"; - }; - 7AB16542256D802200582D43 /* ShellScript */ = { - isa = PBXShellScriptBuildPhase; - alwaysOutOfDate = 1; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - ); - outputFileListPaths = ( - ); - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "# Remove and copy fresh build...\nrm -rf \"${PROJECT_DIR}/../Apple.GameKit_Unity/Assets/Apple.GameKit/Plugins/tvOS/GameKitWrapper.framework\"\ncp -f -R \"${BUILT_PRODUCTS_DIR}/${APPLICATION_NAME}/GameKitWrapper.framework\" \"${PROJECT_DIR}/../Apple.GameKit_Unity/Assets/Apple.GameKit/Plugins/tvOS/\"\n"; - }; - 7AB16546256D803900582D43 /* ShellScript */ = { - isa = PBXShellScriptBuildPhase; - alwaysOutOfDate = 1; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - ); - outputFileListPaths = ( - ); - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "# Remove and copy fresh build...\nrm -rf \"${PROJECT_DIR}/../Apple.GameKit_Unity/Assets/Apple.GameKit/Plugins/macOS/GameKitWrapper.bundle\"\ncp -f -R \"${BUILT_PRODUCTS_DIR}/${APPLICATION_NAME}/GameKitWrapper.bundle\" \"${PROJECT_DIR}/../Apple.GameKit_Unity/Assets/Apple.GameKit/Plugins/macOS/\"\n"; - }; -/* End PBXShellScriptBuildPhase section */ - /* Begin PBXSourcesBuildPhase section */ 7A7E439224B508D40086FB7A /* Sources */ = { isa = PBXSourcesBuildPhase; diff --git a/plug-ins/Apple.GameKit/Native/GameKitWrapper/GKGameCenterViewController.swift b/plug-ins/Apple.GameKit/Native/GameKitWrapper/GKGameCenterViewController.swift index 8c0e4692..f6432c3e 100644 --- a/plug-ins/Apple.GameKit/Native/GameKitWrapper/GKGameCenterViewController.swift +++ b/plug-ins/Apple.GameKit/Native/GameKitWrapper/GKGameCenterViewController.swift @@ -70,6 +70,7 @@ public func GKGameCenterViewController_Present { let target = Unmanaged.fromOpaque(pointer).takeUnretainedValue(); _currentPresentingGameCenterDelegate = GameKitUIDelegateHandler(taskId: taskId, onSuccess: onSuccess); + target.gameCenterDelegate = _currentPresentingGameCenterDelegate; #if os(iOS) || os(tvOS) let viewController = UIApplication.shared.windows.first!.rootViewController;