Unity-Technologies / Unity-Technologies/com.unity.netcode.gameobjects
NetworkTransform misses sync when GameObject is re-enabled; add option for automatic reassertion
Personne n'a encore pris cette issue.
- Langage dominant
- C#
- Étoiles
- 2.3k
- Forks
- 461
- Merge moyen
- 3 j 16 h
- PR mergées (30 j)
- 20
Description
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
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Commencez par le traitement autoritaire côté serveur de Teleport par NetworkTransform lorsque le NetworkObject est inactif, puis reproduisez la séquence décrite de désactivation, de déplacement et de réactivation. Déterminez comment la dernière transformation faisant autorité peut être réappliquée lors de la réactivation et vérifiez que le client reçoit la position mise à jour sans nécessiter un deuxième appel à Teleport.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- csharp, unity
- Domaine
- networking
- Type d'issue
- Bug
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 35/100