Skip to content

Commit 554bbeb

Browse files
fix: ClientNetworkTransform fix with 1.0.1+ changes main (#726)
* Removing RPC based update and bumping package dependency * Adding changelog * bumping versions * missing package lock since 1.0.2 wasn't out yet * changelog update * quick fix for behaviour index out of bound issue
1 parent 6ef055b commit 554bbeb

File tree

7 files changed

+19
-40
lines changed

7 files changed

+19
-40
lines changed

Assets/Scripts/Gameplay/Input/ClientClickFeedback.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ void Start()
2323
{
2424
if (NetworkManager.Singleton.LocalClientId != OwnerClientId)
2525
{
26-
Destroy(this);
26+
enabled = false;
2727
return;
2828
}
2929

Assets/Scripts/Utils/NetworkOverlay/NetworkStats.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public override void OnNetworkSpawn()
7272
bool isClientOnly = IsClient && !IsServer;
7373
if (!IsOwner && isClientOnly) // we don't want to track player ghost stats, only our own
7474
{
75-
Destroy(this);
75+
enabled = false;
7676
return;
7777
}
7878

Packages/com.unity.multiplayer.samples.coop/CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Multiplayer Samples Co-op Changelog
22

3+
## [1.3.1-pre] - 2022-09-13
4+
5+
### Fixed
6+
* Updating ClientNetworkTransform for latest NGO 1.0.1+ (#726) This fixes the new behaviour where both RPCs and netvars were sending the same data. Now CNT is netvar based only, making it send on tick just like NetworkTransform and other network variables would.
7+
38
## [1.3.0-pre] - 2022-06-23
49

510
### Added

Packages/com.unity.multiplayer.samples.coop/Utilities/Net/ClientAuthority/ClientNetworkTransform.cs

-26
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
using Unity.Netcode.Components;
2-
using Unity.Netcode;
32
using UnityEngine;
43

54
namespace Unity.Multiplayer.Samples.Utilities.ClientAuthority
65
{
7-
// TODO inherit from `NetworkBehaviour` instead of `NetworkTransform` to cut direct relationship between two
8-
// TODO change to owner netvar instead of RPC based
96
/// <summary>
107
/// Used for syncing a transform with client side changes. This includes host. Pure server as owner isn't supported by this. Please use NetworkTransform
118
/// for transforms that'll always be owned by the server.
@@ -15,31 +12,8 @@ public class ClientNetworkTransform : NetworkTransform
1512
{
1613
/// <summary>
1714
/// Used to determine who can write to this transform. Owner client only.
18-
/// Changing this value alone will not allow you to create a NetworkTransform which can be written to by clients.
19-
/// We're using RPCs to send updated values from client to server. Netcode doesn't support client side network variable writing.
2015
/// This imposes state to the server. This is putting trust on your clients. Make sure no security-sensitive features use this transform.
2116
/// </summary>
22-
// This is public to make sure that users don't depend on this IsClient && IsOwner check in their code. If this logic changes in the future, we can make it invisible here
23-
24-
public override void OnNetworkSpawn()
25-
{
26-
base.OnNetworkSpawn();
27-
CanCommitToTransform = IsOwner;
28-
}
29-
30-
protected override void Update()
31-
{
32-
CanCommitToTransform = IsOwner;
33-
base.Update();
34-
if (NetworkManager.Singleton != null && (NetworkManager.Singleton.IsConnectedClient || NetworkManager.Singleton.IsListening))
35-
{
36-
if (CanCommitToTransform)
37-
{
38-
TryCommitTransformToServer(transform, NetworkManager.LocalTime.Time);
39-
}
40-
}
41-
}
42-
4317
protected override bool OnIsServerAuthoritative()
4418
{
4519
return false;
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
{
22
"name": "com.unity.multiplayer.samples.coop",
33
"displayName": "Multiplayer Samples Utilities",
4-
"version": "1.3.0-pre",
4+
"version": "1.3.1",
55
"type": "template",
66
"host": "hub",
77
"unity": "2020.3",
88
"description": "Utilities package built on top of Netcode for GameObjects, providing useful scripts and tools.",
99
"dependencies": {
1010
"com.unity.learn.iet-framework": "1.2.1",
11-
"com.unity.multiplayer.tools": "1.0.0-pre.7",
12-
"com.unity.netcode.gameobjects": "1.0.0-pre.10",
11+
"com.unity.multiplayer.tools": "1.0.0",
12+
"com.unity.netcode.gameobjects": "1.0.2",
1313
"com.unity.services.authentication": "1.0.0-pre.4",
1414
"com.unity.services.lobby": "1.0.0-pre.6",
1515
"com.unity.services.relay": "1.0.2"
1616
}
17-
}
17+
}

Packages/manifest.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
"com.unity.ide.vscode": "1.2.5",
1010
"com.unity.learn.iet-framework": "2.2.1",
1111
"com.unity.memoryprofiler": "0.5.0-preview.1",
12-
"com.unity.netcode.gameobjects": "1.0.0-pre.10",
13-
"com.unity.multiplayer.tools": "1.0.0-pre.7",
12+
"com.unity.netcode.gameobjects": "1.0.2",
13+
"com.unity.multiplayer.tools": "1.0.0",
1414
"com.unity.postprocessing": "3.2.1",
1515
"com.unity.render-pipelines.universal": "12.1.6",
1616
"com.unity.services.authentication": "1.0.0-pre.4",

Packages/packages-lock.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -121,15 +121,15 @@
121121
"source": "embedded",
122122
"dependencies": {
123123
"com.unity.learn.iet-framework": "1.2.1",
124-
"com.unity.multiplayer.tools": "1.0.0-pre.7",
125-
"com.unity.netcode.gameobjects": "1.0.0-pre.10",
124+
"com.unity.multiplayer.tools": "1.0.0",
125+
"com.unity.netcode.gameobjects": "1.0.2",
126126
"com.unity.services.authentication": "1.0.0-pre.4",
127127
"com.unity.services.lobby": "1.0.0-pre.6",
128128
"com.unity.services.relay": "1.0.2"
129129
}
130130
},
131131
"com.unity.multiplayer.tools": {
132-
"version": "1.0.0-pre.7",
132+
"version": "1.0.0",
133133
"depth": 0,
134134
"source": "registry",
135135
"dependencies": {
@@ -142,12 +142,12 @@
142142
"url": "https://packages.unity.com"
143143
},
144144
"com.unity.netcode.gameobjects": {
145-
"version": "1.0.0-pre.10",
145+
"version": "1.0.2",
146146
"depth": 0,
147147
"source": "registry",
148148
"dependencies": {
149149
"com.unity.nuget.mono-cecil": "1.10.1",
150-
"com.unity.transport": "1.1.0"
150+
"com.unity.transport": "1.2.0"
151151
},
152152
"url": "https://packages.unity.com"
153153
},
@@ -353,7 +353,7 @@
353353
"url": "https://packages.unity.com"
354354
},
355355
"com.unity.transport": {
356-
"version": "1.1.0",
356+
"version": "1.2.0",
357357
"depth": 1,
358358
"source": "registry",
359359
"dependencies": {

0 commit comments

Comments
 (0)