Skip to content

NetworkObject parent not replicated if Instantiated with parent #2019

@andriyDev

Description

@andriyDev

Description

Instantiating a NetworkObject prefab and passing in a NetworkObject parent causes the client to error with NotServerException.

Reproduce Steps

  1. Start server
  2. Connect with client
  3. Instantiate a NetworkObject prefab on server. Store as someOtherNetworkObject. (This also works with an in-scene NetworkObject).
  4. Instantiate a NetworkObject prefab on server with Instantiate(prefab, Vector3.zero, Quaternion.identity, someOtherNetworkObject).

Actual Outcome

Client produces error of NotServerException: Only the server can reparent NetworkObjects and NetworkObject is not reparented.

Expected Outcome

Object is reparented on client with no error.

Environment

  • OS: Windows
  • Unity Version: 2021.3.2f1
  • Netcode Version: 1.0.0-pre.9

Additional Context

As a workaround, instantiating the GameObject, spawning, then reparenting works. Ideally though this would work automatically, or at least give a message that spawned NetworkObjects should have a null parent.

Metadata

Metadata

Labels

priority:lowThis issue has low priority and will take some time to be resolvedstat:importedStatus - Issue is tracked internally at Unitytype:bugBug Report

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions