Unity-Technologies / Unity-Technologies/com.unity.netcode.gameobjects

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

Aberta
#3,185 6 comentários 0 reações 0 responsáveis Ver no GitHub

Ninguém assumiu esta issue ainda.

Tracking type:docs type:support
Linguagem predominante
C#
Estrelas
2.3k
Forks
461
Merge médio
3d 16h
PRs com merge (30d)
20

Descrição

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]

Guia de contribuição

Abrir o guia de contribuição

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Direção de pesquisa

Comece pelo comportamento de NetworkObject em SpawnWithObservers, Spawn e CheckObjectVisibility, comparando a documentação sobre spawning e visibilidade de objetos vinculada no relatório. Reproduza a sequência de late join com CheckObjectVisibility retornando false e confirme que o objeto permanece ausente no cliente; considera-se concluído quando a visibilidade também for aplicada a futuros clientes que fizerem late join.

Escrita pelo modelo de indexação a partir do texto da issue.

Avaliação

Stack de tecnologia
csharp, unity
Domínio
game-dev, networking
Tipo de issue
Bug
Dificuldade
4/5
Tempo estimado
3-5 dias
Status de atividade
Estagnada
Clareza
Razoavelmente clara
Facilidade para iniciantes
42/100

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.