Unity-Technologies / Unity-Technologies/com.unity.netcode.gameobjects
`NetworkObject` `CheckObjectVisibility` doesn't work on client connection
還沒有人認領這個 Issue。
- 主要語言
- C#
- 星號
- 2.3k
- 分支
- 461
- 平均合併
- 3 天 16 小時
- 30 天內合併 PR
- 20
描述
Description
I want to spawn a networkprefab without any client visibility, first i tried to set no observers before spawn:
NetworkObject.SpawnWithObservers = false;
NetworkObject.Spawn();
this results a spawned object with zero observers, but when a late-join client connects, the object gets spawned on client. The documentation says this is the intended normal behavior, because it only works at the initial spawning.
Then, the documentation says the CheckObjectVisibility will work at both initial spawning and new client connection, so i tried this:
NetworkObject.CheckObjectVisibility += _ => false;
NetworkObject.Spawn();
it did spawn with no observers as the previous approach, but when late-join client connects, it still spawn the object on client.
Reproduce Steps
- start server/host
- spawn a network prefab with
NetworkObject.CheckObjectVisibility += _ => false; - start a client and connect to server
Actual Outcome
a spawned object with visibility always set to false still spawns on late-join client
Expected Outcome
a spawned object with visibility always set to false should be invisible to all connected client and future late-join clients
Environment
- OS: [win10]
- Unity Version: [6000.0.32f1]
- Netcode Version: [2.1.1]
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
從 NetworkObject 的 SpawnWithObservers、Spawn 和 CheckObjectVisibility 行為著手,比較報告中連結的 spawning 與物件可見性文件。重現 CheckObjectVisibility 回傳 false 時的 late-join 序列,並確認物件在用戶端上仍然不存在;完成標準是可見性也會對未來 late-join 的用戶端生效。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- csharp, unity
- 領域
- game-dev, networking
- Issue 類型
- 缺陷
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 42/100