Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NetworkObject CheckObjectVisibility doesn't work on client connection #3185

Open
babaq opened this issue Dec 29, 2024 · 0 comments
Open

NetworkObject CheckObjectVisibility doesn't work on client connection #3185

babaq opened this issue Dec 29, 2024 · 0 comments
Labels
stat:awaiting triage Status - Awaiting triage from the Netcode team. type:bug Bug Report

Comments

@babaq
Copy link

babaq commented Dec 29, 2024

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]
@babaq babaq added stat:awaiting triage Status - Awaiting triage from the Netcode team. type:bug Bug Report labels Dec 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stat:awaiting triage Status - Awaiting triage from the Netcode team. type:bug Bug Report
Projects
None yet
Development

No branches or pull requests

1 participant