Add Support for Nested NetworkObjects in Prefabs
Maintainer antworten meist innerhalb von 2 Tagen
Dieses Issue hat noch niemand übernommen.
- #2645 von @Clicky02 — ohne Merge geschlossen
Bewertung
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Anfängerfreundlichkeit
- 35/100
- Issue-Typ
- Feature
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Veraltet
- Tech-Stack
- csharp
- Bereich
- game-dev, networking
Rechercherichtung
Es werden keine Dateien oder Tests genannt. Beginne damit nachzuverfolgen, wie prefabs und NetworkObjects gespawnt werden, und ermittle dann, wie verschachtelte untergeordnete Objekte registriert und besessen werden; die Aufgabe ist abgeschlossen, wenn das Spawnen eines prefabs seine verschachtelten NetworkObjects automatisch netzwerkfähig macht und dabei die Parent-Zuordnung sowie eine separate Besitzzuordnung beibehält.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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
- Vorherrschende Sprache
- C#
- Sterne
- 2.3k
- Forks
- 464
- Ø Merge
- 2 T. 18 Std.
- Gemergte PRs (30 T.)
- 15
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus Unity-Technologies/com.unity.netcode.gameobjects
-
stat:awaiting-triage stat:import stat:reply-needed type:bug
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 55/100
Unity-Technologies/com.unity.netcode.gameobjects#4179 ·
Maintainer antworten meist innerhalb von 2 Tagen
-
Dedicated server: mixed-authority NetworkObject is removed from NetworkTransformUpdate, so its owner-authoritative NetworkTransform never updates server-sideEvtl. vergeben @NoelStephensUnity hat das vor 11 Tagen übernommen. Offenstat:imported stat:reply-needed type:bug
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 68/100
Unity-Technologies/com.unity.netcode.gameobjects#4159 · 5 Kommentare ·
Maintainer antworten meist innerhalb von 2 Tagen
-
NetworkAnimator: Conditional triggered transitions to Exit node log false errorsEvtl. vergeben @NoelStephensUnity hat das vor 196 Tagen übernommen. Offenstat:awaiting-response stat:awaiting-triage stat:Investigating type:bug
Unity-Technologies/com.unity.netcode.gameobjects#3912 · 7 Kommentare · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 2 Tagen
-
Tracking type:feature-2.x
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 35/100
Unity-Technologies/com.unity.netcode.gameobjects#3870 · 5 Kommentare ·
Maintainer antworten meist innerhalb von 2 Tagen
-
Tracking type:feature
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 48/100
Unity-Technologies/com.unity.netcode.gameobjects#3830 · 7 Kommentare ·
Maintainer antworten meist innerhalb von 2 Tagen
Alle Issues in Unity-Technologies/com.unity.netcode.gameobjects
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 66/100
MicrosoftLearning/PL-400_Microsoft-Power-Platform-Developer#231 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 66/100
joinrpg/joinrpg-net#5313 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 74/100
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 79/100
Maintainer antworten meist innerhalb von 1 Tag