Skip to content

Support spawning a prefab of a NetworkObject that has child NetworkObjects (make re-parenting more consistent in Netcode projects) #2700

Open
@zachstronaut

Description

@zachstronaut

It's possible to have scene objects where a parent NetworkObject has children that are also NetworkObjects. This is particularly notable, because it allows you to re-parent some other NetworkObject onto that nested child NetworkObject in the scene.

When you spawn a prefab of a NetworkObject into the scene, you can only re-parent to the top level of that spawned NetworkObject -- the GameObject that directly has a NetworkObject component -- but none of its children.

This leads to us programmers having to deal with potentially two different code pathways for when a prefab was placed in a scene vs when a prefab was spawned. In some cases we may even have to split prefabs because of this... one that can be placed in scenes and one that can be spawned.

Besides the re-parenting use case, this limitation also gets in the way of modular/nested prefabs in your project. You cannot have a re-usable nested prefab module that is itself spawnable, because then you would not be able to use it on any prefabs that are spawnable themselves.

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