Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

NetworkTransform Teleport() can fail because IsTeleportingNextFrame gets set back to false #3646

Copy link
Copy link
@zachstronaut

Description

@zachstronaut
Issue body actions

Description

NetworkTransform Teleport() can fail because IsTeleportingNextFrame gets set back to false by CheckForStateChange()

Settings for prefab being teleported:

NetworkObject
SyncOwnerTransformWhenParented = false
AllowOwnerToParent = true

NetworkTransform
Authority Mode = Owner
Switch Transform Space When Parented = true
In Local Space = true

Host Harry with one additional Client Charlie.

Harry spawns the prefab with SpawnWithOwnership() and makes Charlie the owner.

It spawns on Charlie's client and NetworkTransform.OnNetworkSpawn() calls SetState() -> SetStateInternal() -> CheckForStateChange()

CheckForStateChange() sees that InLocalSpace != networkState.InLocalSpace and so it sets IsTeleportingNextFrame=False. But also, networkState.InLocalSpace is set to false rather than true because at the moment of spawning the transform.parent is null:

networkState.InLocalSpace = SwitchTransformSpaceWhenParented ? transform.parent != null : InLocalSpace;

Still on the same frame as OnNetworkSpawn(), Charlie calls Teleport() -> SetStateInternal() which sets IsTeleportingNextFrame = true but then calls CheckForStateChange(). Again, it is still true that InLocalSpace != networkState.InLocalSpace, so it sets IsTeleportingNextFrame=False!

When TryCommitTransform runs, IsTeleportingNextFrame is false. The Teleport does not happen.

Environment

OS: Windows 11
Unity Version: 6000.1.3f1
Netcode Version: 2.4.2
Netcode Topology: Client-Server

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority:highThis issue has high priority and we are focusing to resolve itThis issue has high priority and we are focusing to resolve itstat:importedStatus - Issue is tracked internally at UnityStatus - Issue is tracked internally at Unitytype:bugBug ReportBug Report

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.