Allow nested NetworkObjects in prefabs #3072
Labels
stat:awaiting triage
Status - Awaiting triage from the Netcode team.
type:feature
New feature, request or improvement
Is your feature request related to a problem? Please describe.
I am working on a VR multiplayer game and I need a simple way of parenting an object to the players hand. I could use some sort of faking it and not actually parenting it, but I can't find a simple solution that works perfectly. #3013 Improved the parenting function and I would love to use it. The problem is that to parent an object to another both need to have a NetworkObject component.
Describe the solution you'd like
I would like to be able to add nested NetworkObject components inside prefabs. This would allow me to add one to the player itself, and one for each hand. If this is too complicated or doesn't work there might be some other simple way of adding support for this. For example you could modify the parenting function to allow to set the index of the child you want it to be parented to. This is probably not ideal but would work I think. So when picking up an object it would be "parent to the child at index i on this NetworkObject".
Describe alternatives you've considered
Right now I am using my own parenting solution. It uses RPCs and NetworkVariables to tell other clients that the hand just picked something up. This works but is quite complicated. It also doesn't account for stuff like "InLocalSpace". And it has quite a lot of bugs. I would love to just call the parent function and call it a day.
I also tried seperating the hands from the player prefab and spawn them seperatly but it got too complicated since a lot of scripts in my player prefab need a reference to the hands.
Additional context
I have seen this issue on multiple different sites. Many people or facing this problem. Thanks!
The text was updated successfully, but these errors were encountered: