Unity-Technologies / Unity-Technologies/com.unity.netcode.gameobjects

NetworkTransform misses sync when GameObject is re-enabled; add option for automatic reassertion

Abierto
#3,435 4 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

priority:low stat:awaiting-response stat:imported type:feature type:feature-2.x type:support
Lenguaje dominante
C#
Estrellas
2.3k
Forks
461
Merge medio
3 d 16 h
PR fusionados (30 d)
20

Descripción

Description
When using NetworkTransform in server-authoritative mode, if a NetworkObject is deactivated on clients (e.g. via SetActive(false) or scene streaming), any transform changes (e.g. via Teleport) made while it's inactive are not propagated to the client once it's re-enabled. This results in position mismatches, where the client sees the object at its old position while the server has already moved it.

There is no warning, and the desync is silent unless manually corrected.

Reproduction Steps
Spawn a server-authoritative NetworkObject with a NetworkTransform

Deactivate the object on all clients (via RPC or reparenting in a disabled object)

On the server, call Teleport(...) to move the object

Reactivate the object after a short delay

Observe: the client does not reflect the new position

Expected Behavior
Clients should receive the latest authoritative position of the object when it becomes active again.

Workarounds
Currently, we must:

Reapply Teleport() after reactivating the object, or

Use a coroutine to delay the teleport until the object is re-enabled, or

Use custom NetworkVariable logic or whatever boiler plate works instead of NetworkTransform

Suggested Fixes
Add a forceResyncOnEnable bool on NetworkTransform

Internally store the last known transform state, and resend it on reactivation

Or provide an OnNetworkObjectReenabled callback for developers to manually reassert state

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Comienza con el manejo autoritativo del servidor que hace NetworkTransform de Teleport mientras NetworkObject está inactivo y, después, reproduce la secuencia descrita de deshabilitación, movimiento y reactivación. Determina cómo se puede volver a imponer la transformación autoritativa más reciente al reactivarlo y verifica que el cliente reciba la posición actualizada sin requerir una segunda llamada a Teleport.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
csharp, unity
Área
networking
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.