Skip to content

Commit aee21f1

Browse files
authored
fix: Prevent multiple NetworkTransforms on the same object (#1258)
1 parent d3408ac commit aee21f1

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

com.unity.netcode.gameobjects/Components/NetworkTransform.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ namespace Unity.Netcode.Components
1010
/// NetworkTransform will read the underlying transform and replicate it to clients.
1111
/// The replicated value will be automatically be interpolated (if active) and applied to the underlying GameObject's transform
1212
/// </summary>
13+
[DisallowMultipleComponent]
1314
[AddComponentMenu("Netcode/" + nameof(NetworkTransform))]
1415
[DefaultExecutionOrder(100000)] // this is needed to catch the update time after the transform was updated by user scripts
1516
public class NetworkTransform : NetworkBehaviour

com.unity.netcode.gameobjects/Samples/ClientNetworkTransform/Scripts/ClientNetworkTransform.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
using Unity.Netcode.Components;
2+
using UnityEngine;
23

34
namespace Unity.Netcode.Samples
45
{
56
/// <summary>
67
/// Used for syncing a transform with client side changes. This includes host. Pure server as owner isn't supported by this. Please use NetworkTransform
78
/// for transforms that'll always be owned by the server.
89
/// </summary>
10+
[DisallowMultipleComponent]
911
public class ClientNetworkTransform : NetworkTransform
1012
{
1113
/// <summary>

0 commit comments

Comments
 (0)