Skip to content

Commit 3caa4bd

Browse files
AdamSzAppleGitHub Enterprise
authored andcommitted
Fix problems with view controllers on visionOS and elsewhere. (apple#34)
* Simplify view controller presentation. * Fix visionOS availability annotations. * Use default access point location and don't automatically activate it. * Fix tvOS compile error. * Update GameKit changelog.
1 parent c4e145e commit 3caa4bd

File tree

20 files changed

+123
-96
lines changed

20 files changed

+123
-96
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
m_EditorVersion: 2022.3.18f1
2-
m_EditorVersionWithRevision: 2022.3.18f1 (d29bea25151d)
1+
m_EditorVersion: 2022.3.22f1
2+
m_EditorVersionWithRevision: 2022.3.22f1 (887be4894c44)

plug-ins/Apple.GameKit/Apple.GameKit_Unity/Assets/Apple.GameKit/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# CHANGELOG
22
All notable changes to this project will be documented in this file.
33

4+
## [2.2.1] - 2023-04-01
5+
- Fix some issues with how view controllers are handled on visionOS.
6+
47
## [2.2.0] - 2023-02-23
58
### Added
69
- Support for visionOS

plug-ins/Apple.GameKit/Apple.GameKit_Unity/Assets/Apple.GameKit/Demos/Apple.GameKit.Sample/Scripts/AccessPointPanel.cs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,6 @@ public class AccessPointPanel : MonoBehaviour
1010
{
1111
[SerializeField] Dropdown _stateDropdown = default;
1212

13-
// Start is called before the first frame update
14-
void Start()
15-
{
16-
GKAccessPoint.Shared.Location = GKAccessPoint.GKAccessPointLocation.TopLeading;
17-
GKAccessPoint.Shared.ShowHighlights = false;
18-
GKAccessPoint.Shared.IsActive = true;
19-
}
20-
2113
public void OnToggleAccessPoint()
2214
{
2315
GKAccessPoint.Shared.IsActive = !GKAccessPoint.Shared.IsActive;

plug-ins/Apple.GameKit/Apple.GameKit_Unity/Assets/Apple.GameKit/Source/Multiplayer/GKMatch.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,13 @@ protected override void OnDispose(bool isDisposing)
6464
/// <summary>
6565
/// The local player's properties that matchmaking rules used to find the players with some additions.
6666
/// </summary>
67-
[Introduced(iOS: "17.2", macOS: "14.2", tvOS: "17.2")]
67+
[Introduced(iOS: "17.2", macOS: "14.2", tvOS: "17.2", visionOS: "1.1")]
6868
public GKMatchProperties Properties => PointerCast<GKMatchProperties>(Interop.GKMatch_GetProperties(Pointer));
6969

7070
/// <summary>
7171
/// The properties for other players that matchmaking rules uses to find players, with some additions.
7272
/// </summary>
73-
[Introduced(iOS: "17.2", macOS: "14.2", tvOS: "17.2")]
73+
[Introduced(iOS: "17.2", macOS: "14.2", tvOS: "17.2", visionOS: "1.1")]
7474
public NSDictionary<GKPlayer, GKMatchProperties> PlayerProperties => PointerCast<NSDictionary<GKPlayer, GKMatchProperties>>(Interop.GKMatch_GetPlayerProperties(Pointer));
7575

7676
/// <summary>

plug-ins/Apple.GameKit/Apple.GameKit_Unity/Assets/Apple.GameKit/Source/Multiplayer/GKMatchRequest.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ public NSArray<GKPlayer> Recipients
134134
/// <summary>
135135
/// The name of the queue that Game Center places the match request in.
136136
/// </summary>
137-
[Introduced(iOS: "17.2", macOS: "14.2", tvOS: "17.2")]
137+
[Introduced(iOS: "17.2", macOS: "14.2", tvOS: "17.2", visionOS: "1.1")]
138138
public string QueueName
139139
{
140140
get => Interop.GKMatchRequest_GetQueueName(Pointer);
@@ -144,7 +144,7 @@ public string QueueName
144144
/// <summary>
145145
/// The criteria for the local player that Game Center uses to find other players when using matchmaking rules.
146146
/// </summary>
147-
[Introduced(iOS: "17.2", macOS: "14.2", tvOS: "17.2")]
147+
[Introduced(iOS: "17.2", macOS: "14.2", tvOS: "17.2", visionOS: "1.1")]
148148
public GKMatchProperties Properties
149149
{
150150
get => PointerCast<GKMatchProperties>(Interop.GKMatchRequest_GetProperties(Pointer));
@@ -154,7 +154,7 @@ public GKMatchProperties Properties
154154
/// <summary>
155155
/// The criteria for recipients of the match request that Game Center uses to find other players when using matchmaking rules.
156156
/// </summary>
157-
[Introduced(iOS: "17.2", macOS: "14.2", tvOS: "17.2")]
157+
[Introduced(iOS: "17.2", macOS: "14.2", tvOS: "17.2", visionOS: "1.1")]
158158
public NSDictionary<GKPlayer, GKMatchProperties> RecipientProperties
159159
{
160160
get => PointerCast<NSDictionary<GKPlayer, GKMatchProperties>>(Interop.GKMatchRequest_GetRecipientProperties(Pointer));

plug-ins/Apple.GameKit/Apple.GameKit_Unity/Assets/Apple.GameKit/Source/Multiplayer/GKMatchedPlayers.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace Apple.GameKit.Multiplayer
1010
/// <summary>
1111
/// An object that represents matchmaking results, including the players that join the match and their properties that matchmaking rules uses.
1212
/// </summary>
13-
[Introduced(iOS: "17.2", macOS: "14.2", tvOS: "17.2")]
13+
[Introduced(iOS: "17.2", macOS: "14.2", tvOS: "17.2", visionOS: "1.1")]
1414
public class GKMatchedPlayers : NSObject
1515
{
1616
/// <summary>

plug-ins/Apple.GameKit/Apple.GameKit_Unity/Assets/Apple.GameKit/Source/Multiplayer/GKMatchmaker.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ private static void OnFindPlayersError(long taskId, IntPtr errorPointer)
131131
/// </summary>
132132
/// <param name="matchRequest">The configuration for the match.</param>
133133
/// <returns>The players that join the match, including their properties that matchmaking rules uses. If unsuccessful, this parameter is null.</returns>
134-
[Introduced(iOS: "17.2", macOS: "14.2", tvOS: "17.2")]
134+
[Introduced(iOS: "17.2", macOS: "14.2", tvOS: "17.2", visionOS: "1.1")]
135135
public Task<GKMatchedPlayers> FindMatchedPlayers(GKMatchRequest matchRequest)
136136
{
137137
var tcs = InteropTasks.Create<GKMatchedPlayers>(out var taskId);
@@ -216,7 +216,7 @@ private static void OnQueryActivityError(long taskId, IntPtr errorPointer)
216216
/// The string should be in reverse-DNS format and queue names are case sensitive.
217217
/// </param>
218218
/// <returns>The number of match requests in the queue during the previous 60 seconds.</returns>
219-
[Introduced(iOS: "17.2", macOS: "14.2", tvOS: "17.2")]
219+
[Introduced(iOS: "17.2", macOS: "14.2", tvOS: "17.2", visionOS: "1.1")]
220220
public Task<long> QueryQueueActivity(string queueName)
221221
{
222222
var tcs = InteropTasks.Create<long>(out var taskId);
@@ -387,8 +387,10 @@ private static class Interop
387387
public static extern void GKMatchmaker_StartBrowsingForNearbyPlayers(IntPtr gkMatchmakerPtr, InternalNearbyPlayerReachableHandler nearbyPlayerReachableHandler);
388388
[DllImport(InteropUtility.DLLName)]
389389
public static extern void GKMatchmaker_StopBrowsingForNearbyPlayers(IntPtr gkMatchmakerPtr);
390+
#if !UNITY_TVOS
390391
[DllImport(InteropUtility.DLLName)]
391392
public static extern void GKMatchmaker_StartGroupActivity(IntPtr gkMatchmakerPtr, InternalPlayerJoiningGroupActivityHandler playerJoiningGroupActivityHandler);
393+
#endif
392394
[DllImport(InteropUtility.DLLName)]
393395
public static extern void GKMatchmaker_StopGroupActivity(IntPtr gkMatchmakerPtr);
394396
}

plug-ins/Apple.GameKit/Apple.GameKit_Unity/Assets/Apple.GameKit/Source/Multiplayer/GKMatchmakerViewControllerDelegate.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,14 +147,14 @@ private static void OnHostedPlayerDidAccept(IntPtr pointer, IntPtr matchmakerVie
147147
/// <param name="matchmakerViewController">The view controller that finds players for the match.</param>
148148
/// <param name="invitedPlayer">A player to invite to the match.</param>
149149
/// <returns>The properties for recipient that the local player invites to the match.</returns>
150-
[Introduced(iOS: "17.2", macOS: "14.2", tvOS: "17.2")]
150+
[Introduced(iOS: "17.2", macOS: "14.2", tvOS: "17.2", visionOS: "1.1")]
151151
public delegate Task<GKMatchProperties> GetMatchPropertiesForRecipientHandler(GKMatchmakerViewController matchmakerViewController, GKPlayer invitedPlayer);
152152
private delegate void InteropGetMatchPropertiesForRecipientHandler(IntPtr gkMatchmakerViewControllerDelegatePtr, IntPtr gkMatchmakerViewControllerPtr, IntPtr gkPlayerPtr, IntPtr completionHandlerPtr);
153153

154154
/// <summary>
155155
/// Dispatches GetMatchPropertiesForRecipient events.
156156
/// </summary>
157-
[Introduced(iOS: "17.2", macOS: "14.2", tvOS: "17.2")]
157+
[Introduced(iOS: "17.2", macOS: "14.2", tvOS: "17.2", visionOS: "1.1")]
158158
public event GetMatchPropertiesForRecipientHandler GetMatchPropertiesForRecipient;
159159

160160
[MonoPInvokeCallback(typeof(InteropGetMatchPropertiesForRecipientHandler))]
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
m_EditorVersion: 2022.3.18f1
2-
m_EditorVersionWithRevision: 2022.3.18f1 (d29bea25151d)
1+
m_EditorVersion: 2022.3.22f1
2+
m_EditorVersionWithRevision: 2022.3.22f1 (887be4894c44)

plug-ins/Apple.GameKit/Native/GameKitWrapper.xcodeproj/project.pbxproj

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,10 @@
163163
FB8694492AD73AE5009B8676 /* GKMatchedPlayers.m in Sources */ = {isa = PBXBuildFile; fileRef = FB8694482AD73AE5009B8676 /* GKMatchedPlayers.m */; };
164164
FB86944A2AD73AE5009B8676 /* GKMatchedPlayers.m in Sources */ = {isa = PBXBuildFile; fileRef = FB8694482AD73AE5009B8676 /* GKMatchedPlayers.m */; };
165165
FB86944B2AD73AE5009B8676 /* GKMatchedPlayers.m in Sources */ = {isa = PBXBuildFile; fileRef = FB8694482AD73AE5009B8676 /* GKMatchedPlayers.m */; };
166+
FB89C4EB2BAE49320078B971 /* UiUtilities.swift in Sources */ = {isa = PBXBuildFile; fileRef = FB89C4EA2BAE49320078B971 /* UiUtilities.swift */; };
167+
FB89C4EC2BAE4BA20078B971 /* UiUtilities.swift in Sources */ = {isa = PBXBuildFile; fileRef = FB89C4EA2BAE49320078B971 /* UiUtilities.swift */; };
168+
FB89C4ED2BAE4BA30078B971 /* UiUtilities.swift in Sources */ = {isa = PBXBuildFile; fileRef = FB89C4EA2BAE49320078B971 /* UiUtilities.swift */; };
169+
FB89C4EE2BAE4BA40078B971 /* UiUtilities.swift in Sources */ = {isa = PBXBuildFile; fileRef = FB89C4EA2BAE49320078B971 /* UiUtilities.swift */; };
166170
/* End PBXBuildFile section */
167171

168172
/* Begin PBXFileReference section */
@@ -213,6 +217,7 @@
213217
7AE5BBA22502C0DD00BDBEDA /* GameKitWrapper.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = GameKitWrapper.framework; sourceTree = BUILT_PRODUCTS_DIR; };
214218
FB7384C92ADE05A200616362 /* GKErrorCodeExtension.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GKErrorCodeExtension.h; sourceTree = "<group>"; };
215219
FB8694482AD73AE5009B8676 /* GKMatchedPlayers.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GKMatchedPlayers.m; sourceTree = "<group>"; };
220+
FB89C4EA2BAE49320078B971 /* UiUtilities.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UiUtilities.swift; sourceTree = "<group>"; };
216221
/* End PBXFileReference section */
217222

218223
/* Begin PBXFrameworksBuildPhase section */
@@ -271,6 +276,7 @@
271276
7A9B815524A4FC3800FB2FE8 /* GameKitWrapper */ = {
272277
isa = PBXGroup;
273278
children = (
279+
FB89C4EA2BAE49320078B971 /* UiUtilities.swift */,
274280
7A7D6B7F25D6E7650072DB37 /* AccessPoint_BridgingHeader.h */,
275281
7A4ADFE924DDF23400664BD3 /* AccessPoint.swift */,
276282
7A486BA926A09D7A00255BD5 /* AppleCoreRuntimeShared.h */,
@@ -552,6 +558,7 @@
552558
24B0647A2B7F29E1007ABBB8 /* GKAchievement.swift in Sources */,
553559
24B0647B2B7F29E1007ABBB8 /* GKVoiceChat.swift in Sources */,
554560
24B0647C2B7F29E1007ABBB8 /* GKTurnBasedMatchDelegate.swift in Sources */,
561+
FB89C4ED2BAE4BA30078B971 /* UiUtilities.swift in Sources */,
555562
24B0647D2B7F29E1007ABBB8 /* GKTurnBasedMatch.swift in Sources */,
556563
24B0647E2B7F29E1007ABBB8 /* GKMatchmakerViewController.swift in Sources */,
557564
24B0647F2B7F29E1007ABBB8 /* GameKitUIDelegateHandler.swift in Sources */,
@@ -594,6 +601,7 @@
594601
7AA8AD5E2729EF5500D3F909 /* GKAchievement.swift in Sources */,
595602
7A7E43A124B509130086FB7A /* GameKitUIDelegateHandler.swift in Sources */,
596603
7AA8AD9F272A46AF00D3F909 /* GKVoiceChat.swift in Sources */,
604+
FB89C4EE2BAE4BA40078B971 /* UiUtilities.swift in Sources */,
597605
7AA8ADB3272B02AF00D3F909 /* GKTurnBasedMatchDelegate.swift in Sources */,
598606
7AA8ADAE272AF7A000D3F909 /* GKTurnBasedMatch.swift in Sources */,
599607
7AA8AD90272A3EE600D3F909 /* GKMatchmakerViewController.swift in Sources */,
@@ -636,6 +644,7 @@
636644
7AA8AD5C2729EF5500D3F909 /* GKAchievement.swift in Sources */,
637645
7AA8AD9D272A46AF00D3F909 /* GKVoiceChat.swift in Sources */,
638646
7AA8ADB1272B02AF00D3F909 /* GKTurnBasedMatchDelegate.swift in Sources */,
647+
FB89C4EB2BAE49320078B971 /* UiUtilities.swift in Sources */,
639648
7AA8ADAC272AF7A000D3F909 /* GKTurnBasedMatch.swift in Sources */,
640649
7AA8AD8E272A3EE600D3F909 /* GKMatchmakerViewController.swift in Sources */,
641650
7A50579324ABD01000477507 /* GameKitUIDelegateHandler.swift in Sources */,
@@ -678,6 +687,7 @@
678687
7AA8AD5D2729EF5500D3F909 /* GKAchievement.swift in Sources */,
679688
7AA8AD9E272A46AF00D3F909 /* GKVoiceChat.swift in Sources */,
680689
7AA8ADB2272B02AF00D3F909 /* GKTurnBasedMatchDelegate.swift in Sources */,
690+
FB89C4EC2BAE4BA20078B971 /* UiUtilities.swift in Sources */,
681691
7AA8ADAD272AF7A000D3F909 /* GKTurnBasedMatch.swift in Sources */,
682692
7AA8AD8F272A3EE600D3F909 /* GKMatchmakerViewController.swift in Sources */,
683693
7AE5BB9C2502C0DD00BDBEDA /* GameKitUIDelegateHandler.swift in Sources */,

0 commit comments

Comments
 (0)