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

Los mantenedores suelen responder en 3 días

Nadie ha tomado este issue todavía.

Evaluación

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

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.

Descripción

priority:low stat:awaiting-response stat:imported type:feature type:feature-2.x type:support

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

Lenguaje dominante
C#
Estrellas
2.3k
Forks
465
Merge medio
3 d 12 h
PR fusionados (30 d)
39

Preparar el entorno

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.

Más de Unity-Technologies/com.unity.netcode.gameobjects

Todos los issues de Unity-Technologies/com.unity.netcode.gameobjects

Issues similares

Más issues de C#

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.