{"id":30352376,"url":"https://github.com/pietras333/unity-networking-parenting-solution-for-distributed-authority","last_synced_at":"2025-08-19T00:21:09.961Z","repository":{"id":307882818,"uuid":"1030985070","full_name":"pietras333/unity-networking-parenting-solution-for-distributed-authority","owner":"pietras333","description":"A robust solution for parenting network objects under deeply nested GameObjects in Unity Netcode for GameObjects with Distributed Authority topology.","archived":false,"fork":false,"pushed_at":"2025-08-02T19:02:22.000Z","size":12,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-02T20:55:18.427Z","etag":null,"topics":["csharp","gamedev","multiplayer","netcode-for-gameobjects","networking","unity3d"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pietras333.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-08-02T18:53:34.000Z","updated_at":"2025-08-02T19:03:29.000Z","dependencies_parsed_at":"2025-08-02T20:55:20.649Z","dependency_job_id":"b566cdb2-a8ee-4090-8a09-96df21f525c2","html_url":"https://github.com/pietras333/unity-networking-parenting-solution-for-distributed-authority","commit_stats":null,"previous_names":["pietras333/unity-networking-parenting-solution-for-distributed-authority"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/pietras333/unity-networking-parenting-solution-for-distributed-authority","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pietras333%2Funity-networking-parenting-solution-for-distributed-authority","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pietras333%2Funity-networking-parenting-solution-for-distributed-authority/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pietras333%2Funity-networking-parenting-solution-for-distributed-authority/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pietras333%2Funity-networking-parenting-solution-for-distributed-authority/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pietras333","download_url":"https://codeload.github.com/pietras333/unity-networking-parenting-solution-for-distributed-authority/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pietras333%2Funity-networking-parenting-solution-for-distributed-authority/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271079230,"owners_count":24695597,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-18T02:00:08.743Z","response_time":89,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["csharp","gamedev","multiplayer","netcode-for-gameobjects","networking","unity3d"],"created_at":"2025-08-19T00:21:06.042Z","updated_at":"2025-08-19T00:21:09.947Z","avatar_url":"https://github.com/pietras333.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🎮 Unity Network Parenting Solution\n\nA robust solution for parenting network objects under deeply nested GameObjects in Unity Netcode for GameObjects with **Distributed Authority** topology.\n\nhttps://github.com/user-attachments/assets/8fa29e3c-a4e0-425f-a970-83b45b1c3d80\n\u003cdiv align=\"center\"\u003e\n\n\u003cimg width=\"505\" height=\"390\" alt=\"image\" src=\"https://github.com/user-attachments/assets/4308c1d0-37b7-4f74-8728-f92e97fbe765\" /\u003e\n\n\u003cimg width=\"566\" height=\"269\" alt=\"image\" src=\"https://github.com/user-attachments/assets/576cc186-497f-426b-b894-13b0fd4714a1\" /\u003e\n\u003c/div\u003e\n\n## 🚀 Features\n\n- ✨ **Deep Nesting Support**: Parent network objects to deeply nested child GameObjects\n- 🔄 **Automatic Synchronization**: All clients receive parenting changes automatically\n- 🕐 **Late Join Support**: Players joining mid-game see correct object hierarchy\n- 🎯 **Simple API**: One method call to parent any network object\n- 🏗️ **Distributed Authority**: Designed for distributed authority network topology\n\n## 📋 Prerequisites\n\n- Unity Netcode for GameObjects\n- Network Manager with **Distributed Authority** topology\n- Target network objects must have **Auto Object Parent Sync turned OFF**\n- Network objects to be parented must have **Ownership set to None**\n\n## 🔧 Setup\n\n### 1️⃣ Add Network Parent Centre\n\nAttach the `NetworkParentCentre` component to the **root GameObject** of your network object (e.g., Player):\n\n```\nPlayer (Network Object) ← NetworkParentCentre goes here\n├── Arm (child)\n│   └── Hand (child) ← NetworkParent goes here\n└── Other components...\n```\n\n### 2️⃣ Configure Network Parents\n\nAdd `NetworkParent` components to any child GameObject where you want to enable parenting:\n\n```csharp\n// On the Hand GameObject\nNetworkParent networkParent = handGameObject.GetComponent\u003cNetworkParent\u003e();\nnetworkParent.NetworkParentId = \"Object Holder Network Parent\";\n```\n\n### 3️⃣ Parent Network Objects\n\nUse the simple API to parent any spawned network object:\n\n```csharp\n// Get reference to the Network Parent Centre\nNetworkParentCentre parentCentre = playerGameObject.GetComponent\u003cNetworkParentCentre\u003e();\n\n// Parent the network item (e.g., weapon) to the specified parent\nbool success = parentCentre.TryToParentNetworkObject(weaponNetworkObject, \"Object Holder Network Parent\");\n```\n\n## 💡 Example Use Case\n\nPerfect for scenarios like:\n- 🗡️ **Weapon Systems**: Parenting weapons to player hands\n- 📦 **Inventory Items**: Attaching items to specific body parts\n- 🎒 **Equipment**: Mounting gear to character attachment points\n- 🚗 **Vehicle Interactions**: Placing objects inside vehicles\n\n## ⚙️ Configuration Requirements\n\n| Setting | Value | Location |\n|---------|--------|----------|\n| Network Manager Topology | `Distributed Authority` | Network Manager |\n| Auto Object Parent Sync | `OFF` | Network Object to be parented |\n| Object Ownership | `None` | Network Object to be parented |\n\n## 📝 API Reference\n\n### NetworkParentCentre\n\n```csharp\npublic bool TryToParentNetworkObject(NetworkObjectReference networkObjectReference, string networkParentId)\n```\n\n**Parameters:**\n- `networkObjectReference`: The network object to be parented\n- `networkParentId`: The identifier of the target parent\n\n**Returns:** `bool` - Success status of the parenting operation\n\n### NetworkParent\n\n```csharp\npublic string NetworkParentId; // Set this to identify the parent location\n```\n\n## 🔍 How It Works\n\n1. **Initialization**: `NetworkParentCentre` discovers all `NetworkParent` components in children\n2. **Parenting Request**: Call `TryToParentNetworkObject()` with target object and parent ID\n3. **Local Parenting**: Object is immediately parented locally on the owner\n4. **Network Sync**: `ClientRpc` synchronizes the parenting across all clients\n5. **Late Join Support**: New clients automatically receive the correct hierarchy\n\n## 🚨 Important Notes\n\n- ⚠️ Only the **owner** of the NetworkParentCentre can initiate parenting operations\n- 🏗️ NetworkParentCentre must be on a **root GameObject** (no parent)\n- 🔒 Target network objects must have **ownership set to None**\n- 📴 Ensure **Auto Object Parent Sync is disabled** on objects to be parented\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpietras333%2Funity-networking-parenting-solution-for-distributed-authority","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpietras333%2Funity-networking-parenting-solution-for-distributed-authority","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpietras333%2Funity-networking-parenting-solution-for-distributed-authority/lists"}