Skip to content

OnNetworkSpawn() does not get invoked on child NetworkObjects of a NetworkPrefab. #1389

Closed as not planned
@fernando-cortez

Description

@fernando-cortez

Describe the bug
When a NetworkPrefab spawns, OnNetworkSpawn() callback on child NetworkBehaviours are not getting called, when the child itself also contains a NetworkObject.

To Reproduce
Steps to reproduce the behavior:

  1. Spawn a NetworkObject prefab that contains a child NetworkObject with a NetworkBehaviour.
  2. Notice that on spawn, the NetworkBehaviour's OnNetworkSpawn() callback is not invoked on NetworkBehaviours.

Actual outcome
The child NetworkBehaviours are never initialized via the network.

Expected outcome
Child NetworkBehaviours should have their OnNetworkSpawn() invoked.

Screenshots
If applicable, add screenshots to help explain your problem.

Environment (please complete the following information):

  • OS: [e.g. Windows 10]
  • Unity Version: [2020.3]
  • Netcode Commit: [https://github.com/Unity-Technologies/com.unity.netcode.gameobjects/commit/14fd79d4e6bb8875e33325062958d8590b25539a]

Additional context
Add any other context about the problem here. Logs, code snippets would be useful here but please also consider attaching a minimal Unity project that reproduces the issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:featureNew feature, request or improvement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions