Skip to content

Commit 6caa2e9

Browse files
committedDec 1, 2024
updating code samples that uses CurrentPlayer.ReadOnlyTags
Return value of CurrentPlayer.ReadOnlyTags has been changed from `IReadOnlyCollection<string>` to `string[]` since 1.0.0. As `string[]` doesn't have `.Contains()` method, it should be adjusted.
1 parent 9750c04 commit 6caa2e9

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed
 

‎mppm/player-tags/target-instance.md

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ This example uses [Netcode for GameObjects](https://docs-multiplayer.unity3d.com
2121
:::
2222

2323
```csharp
24+
using System.Linq;
2425
using Unity.Netcode;
2526
using UnityEngine;
2627
using Unity.Multiplayer.Playmode;

‎mppm/player-tags/target-network.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ This example uses the [Network Simulator](https://docs-multiplayer.unity3d.com/t
1717
```csharp
1818
using System.Collections;
1919
using System.Collections.Generic;
20+
using System.Linq;
2021
using UnityEngine;
2122
using Unity.Multiplayer.Playmode;
2223
using Unity.Multiplayer.Tools.NetworkSimulator.Runtime;
@@ -29,11 +30,11 @@ public class NetworkSimulation : MonoBehaviour
2930
gameObject.AddComponent<NetworkSimulator>();
3031

3132
var connectionPreset = NetworkSimulatorPresets.None;
32-
if (CurrentPlayer.ReadOnlyTags() == "FastNetwork")
33+
if (CurrentPlayer.ReadOnlyTags().Contains("FastNetwork"))
3334
{
3435
connectionPreset = NetworkSimulatorPresets.HomeBroadband;
3536
}
36-
else if (CurrentPlayer.ReadOnlyTags() == "SlowNetwork")
37+
else if (CurrentPlayer.ReadOnlyTags().Contains("SlowNetwork"))
3738
{
3839
connectionPreset = NetworkSimulatorPresets.Mobile2_5G;
3940
}

‎mppm/player-tags/target-team.md

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ The following script automatically sets a [NetworkVariable](https://docs-multipl
1717
A Player with a `Red` tag automatically sets the `Team` NetworkVariable to `Red`. A Player with a `Blue` tag automatically sets the `Team` NetworkVariable to `Blue`.
1818

1919
```csharp
20+
using System.Linq;
2021
using Unity.Netcode;
2122
using UnityEngine;
2223
using Unity.Multiplayer.Playmode;

0 commit comments

Comments
 (0)