sbox-issues icon indicating copy to clipboard operation
sbox-issues copied to clipboard

`[Property]` on a `NetworkMode.Never` GameObject is attempted to be read by other players

Open PolSpock opened this issue 6 months ago • 1 comments

Describe the bug

Hi,

Adding a [Property] attribute to a GameObject whose NetworkMode is set to NetworkMode.Never will be attempted to be read by other players, triggering an Unknown GameObject c8401b65-398b-4d71-a9e6-511b3d4489f3 warning in the console.

To Reproduce

  1. Download https://github.com/Facepunch/sbox-scenestaging
  2. Edit NetworkTest.cs by adding the following code:
	[Property] public GameObject NeverNetworked { get; set; }
	[Property] public Gun ComponentIntoNeverNetworkedGameObject { get; set; }

	protected override void OnStart()
	{
		base.OnStart();

		if (IsProxy) return;

		NeverNetworked = new GameObject();
		NeverNetworked.Name = "NeverNetworked";
		NeverNetworked.Parent = GameObject;
		NeverNetworked.NetworkMode = NetworkMode.Never;

		ComponentIntoNeverNetworkedGameObject = NeverNetworked.Components.Create<Gun>();
	}
  1. Play networking.scene and join with another user. Check the console and see the warning image
  2. Remove the Property attribute from public GameObject NeverNetworked { get; set; } and restart: no error should occur.

Expected behavior

A GameObject set to NetworkMode.Never should not print an error even if the [Property] attribute is present

Media/Files

No response

Additional context

No response

PolSpock avatar Aug 09 '24 19:08 PolSpock