Skip to content

Commit

Permalink
updating code samples that uses CurrentPlayer.ReadOnlyTags
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Cj-bc committed Dec 6, 2024
1 parent 771b9e2 commit 89a6dc2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions mppm/player-tags/target-instance.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ This example uses [Netcode for GameObjects](https://docs-multiplayer.unity3d.com
:::

```csharp
using System.Linq;
using Unity.Netcode;
using UnityEngine;
using Unity.Multiplayer.Playmode;
Expand Down
5 changes: 3 additions & 2 deletions mppm/player-tags/target-network.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ This example uses the [Network Simulator](https://docs-multiplayer.unity3d.com/t
```csharp
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using Unity.Multiplayer.Playmode;
using Unity.Multiplayer.Tools.NetworkSimulator.Runtime;
Expand All @@ -29,11 +30,11 @@ public class NetworkSimulation : MonoBehaviour
gameObject.AddComponent<NetworkSimulator>();

var connectionPreset = NetworkSimulatorPresets.None;
if (CurrentPlayer.ReadOnlyTags() == "FastNetwork")
if (CurrentPlayer.ReadOnlyTags().Contains("FastNetwork"))
{
connectionPreset = NetworkSimulatorPresets.HomeBroadband;
}
else if (CurrentPlayer.ReadOnlyTags() == "SlowNetwork")
else if (CurrentPlayer.ReadOnlyTags().Contains("SlowNetwork"))
{
connectionPreset = NetworkSimulatorPresets.Mobile2_5G;
}
Expand Down
1 change: 1 addition & 0 deletions mppm/player-tags/target-team.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ The following script automatically sets a [NetworkVariable](https://docs-multipl
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`.

```csharp
using System.Linq;
using Unity.Netcode;
using UnityEngine;
using Unity.Multiplayer.Playmode;
Expand Down

0 comments on commit 89a6dc2

Please sign in to comment.