Add Support for Nested NetworkObjects in Prefabs
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 35/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bastante claro
- Estado de actividad
- Estancado
- Stack tecnológico
- csharp
- Área
- game-dev, networking
Línea de trabajo
No se nombran archivos ni pruebas. Empieza rastreando cómo se generan los prefabs y los NetworkObjects, y determina después cómo se registrarían y poseerían los objetos secundarios anidados; se considera terminado cuando generar un prefab conecta automáticamente a la red sus NetworkObjects anidados, conservando la relación de parenting y una propiedad independiente.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Is your feature request related to a problem? Please describe.
One major pain point of using Unity Netcode for GameObjects (as well as many other networking solutions) is the lack of support for spawning nested NetworkObjects. Currently, if you try to spawn a prefab with nested NetworkObjects, the primary NetworkObject will be networked, while all the child NetworkObjects will not.
As an example, imagine that you are trying to spawn a boat with cannons that each player can move and shoot. In this scenario, it would make sense that (1) cannons should be parented to the boat and (2) any player should be able to take ownership of a cannon (separate of the boat) when they go to move/shoot it. This means that both the boat and the cannons would need to be NetworkObjects. However, because of this limitation, you would not be able to make one boat prefab with the cannons on it.
Describe the solution you'd like
Ideally, when a prefab with nested NetworkObjects is spawned, it should automatically network any child network objects.
Describe alternatives you've considered
You can work around the issues with nested NetworkObjects, but it requires designing your prefabs/scripts in less intuitive ways.
For instance, in the boat example I mentioned earlier, you could create cannon spawners that spawn the cannons separately when the boat is spawned. However, this has its own issues. Primarily:
- It is harder to position the cannons.
- If you just try to position the cannons with the transform of the spawner, it will be difficult to visualize the final product.
- Positioning the cannon prefab first and then replacing it with the spawner requires more work than necessary. Also, what if the boat model changes and you need to reposition the cannons? You'll have to add back in the cannon prefab, position it, move the spawner to that position, and delete the cannon prefab.
- In Editor, scripts on the boat cannot reference scripts on the cannons (and vice versa).
- This means you may have to wire up scripts at runtime.
- This also means that your code will have to check to make sure that the cannons have been spawned in before doing anything with them, since they aren't necessarily spawned at the same time as the boat.
There are other solutions to these types of problems, but they are generally more difficult to implement and/or encourage poor design.
Additional context
N/A
- Lenguaje dominante
- C#
- Estrellas
- 2.3k
- Forks
- 461
- Merge medio
- 3 d 16 h
- PR fusionados (30 d)
- 20
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de Unity-Technologies/com.unity.netcode.gameobjects
-
stat:import type:bug
Dificultad 4/5 3-5 días Aptitud para principiantes 68/100
-
stat:reply-needed type:support
Dificultad 4/5 3-5 días Aptitud para principiantes 55/100
Unity-Technologies/com.unity.netcode.gameobjects#4095 · 10 comentarios ·
-
stat:awaiting-triage stat:Investigating type:bug
Unity-Technologies/com.unity.netcode.gameobjects#3912 · 5 comentarios · 1 asignado ·
-
Tracking type:feature-2.x
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
Unity-Technologies/com.unity.netcode.gameobjects#3870 · 5 comentarios ·
-
Please error, or at least warn, when a managed type is included in INetworkSerializeByMemcpy AbiertoTracking type:feature
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
Unity-Technologies/com.unity.netcode.gameobjects#3830 · 7 comentarios ·
Todos los issues de Unity-Technologies/com.unity.netcode.gameobjects
Issues similares
-
bug
Dificultad 1/5 Menos de una hora Aptitud para principiantes 75/100
sillsdev/languageforge-lexbox#2665 ·
-
bug documentation frontend
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
azurenoops/spin_agent#975 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
-
:watch: Not Triaged 11.0 fundamentals/subsvc
Dificultad 2/5 1-3 horas Aptitud para principiantes 92/100
dotnet/AspNetCore.Docs#37699 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
SubtitleEdit/subtitleedit#15108 · 1 comentario ·