`NetworkObject` `CheckObjectVisibility` doesn't work on client connection

オープン
#3,185 コメント 6 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
42/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
csharp, unity

調査の方向性

NetworkObject の SpawnWithObservers、Spawn、CheckObjectVisibility の動作から始め、レポートにリンクされている spawning とオブジェクト可視性のドキュメントを比較します。CheckObjectVisibility が false を返す late-join シーケンスを再現し、オブジェクトがクライアントに存在しないままであることを確認します。完了条件は、今後 late-join するクライアントに対しても可視性が適用されることです。

索引モデルが issue の本文から書いたものです。

説明

Tracking type:docs type:support
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
  1. start server/host
  2. spawn a network prefab with NetworkObject.CheckObjectVisibility += _ => false;
  3. 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]
主要言語
C#
スター
2.3k
フォーク
461
平均マージ
3日 16時間
マージ済み PR(30日)
20

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

Unity-Technologies/com.unity.netcode.gameobjects のほかの issue

Unity-Technologies/com.unity.netcode.gameobjects の issue をすべて見る

似ている issue

C# の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。