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

Error from DebugManager's Write Scene Object Details option #642

Closed
maxkratt opened this issue Apr 6, 2024 · 7 comments
Closed

Error from DebugManager's Write Scene Object Details option #642

maxkratt opened this issue Apr 6, 2024 · 7 comments

Comments

@maxkratt
Copy link
Sponsor Contributor

maxkratt commented Apr 6, 2024

General
Unity version: 2021.3.33f1
Fish-Networking version: 4.1.6
Discord link: https://discord.com/channels/424284635074134018/1217847853314080820/1217907567456424006
Credit to rikusen0335 for creating the original example.

Description
Using the DebugManager's "Write Scene Object Details" option can in some cases produce the following error:

ArgumentOutOfRangeException: ArgumentOutOfRange_NeedNonNegNum
Parameter name: count
System.ArraySegment`1[T]..ctor (System.Byte[] array, System.Int32 offset, System.Int32 count) (at <7e05db41a20b45108859fa03b97088d4>:0)
FishNet.Serializing.Reader.ReadArraySegment (System.Int32 count) (at Assets/FishNet/Runtime/Serializing/Reader.cs:381)
FishNet.Managing.Client.ClientObjects.CacheSpawn (FishNet.Serializing.PooledReader reader) (at Assets/FishNet/Runtime/Managing/Client/Object/ClientObjects.cs:447)
FishNet.Managing.Client.ClientManager.ParseReader (FishNet.Serializing.PooledReader reader, FishNet.Transporting.Channel channel, System.Boolean print) (at Assets/FishNet/Runtime/Managing/Client/ClientManager.cs:426)
FishNet.Managing.Client.ClientManager.ParseReceived (FishNet.Transporting.ClientReceivedDataArgs args) (at Assets/FishNet/Runtime/Managing/Client/ClientManager.cs:370)
FishNet.Managing.Client.ClientManager.Transport_OnClientReceivedData (FishNet.Transporting.ClientReceivedDataArgs args) (at Assets/FishNet/Runtime/Managing/Client/ClientManager.cs:328)
FishNet.Transporting.Tugboat.Tugboat.HandleClientReceivedDataArgs (FishNet.Transporting.ClientReceivedDataArgs receivedDataArgs) (at Assets/FishNet/Runtime/Transporting/Transports/Tugboat/Tugboat.cs:238)
FishNet.Transporting.Tugboat.Client.ClientSocket.IterateIncoming () (at Assets/FishNet/Runtime/Transporting/Transports/Tugboat/Core/ClientSocket.cs:295)
FishNet.Transporting.Tugboat.Tugboat.IterateIncoming (System.Boolean server) (at Assets/FishNet/Runtime/Transporting/Transports/Tugboat/Tugboat.cs:211)
FishNet.Managing.Transporting.TransportManager.IterateIncoming (System.Boolean server) (at Assets/FishNet/Runtime/Managing/Transporting/TransportManager.cs:708)
FishNet.Managing.Timing.TimeManager.TryIterateData (System.Boolean incoming) (at Assets/FishNet/Runtime/Managing/Timing/TimeManager.cs:1066)
FishNet.Managing.Timing.TimeManager.IncreaseTick () (at Assets/FishNet/Runtime/Managing/Timing/TimeManager.cs:718)
FishNet.Managing.Timing.TimeManager.<TickUpdate>g__MethodLogic|97_0 () (at Assets/FishNet/Runtime/Managing/Timing/TimeManager.cs:390)
FishNet.Managing.Timing.TimeManager.TickUpdate () (at Assets/FishNet/Runtime/Managing/Timing/TimeManager.cs:380)
FishNet.Transporting.NetworkReaderLoop.Update () (at Assets/FishNet/Runtime/Transporting/NetworkReaderLoop.cs:28)

Replication
Steps to reproduce the behavior:

  1. Import example package
  2. Add the example scene to the build settings
  3. Build and run the game. It will start as a host.
  4. Press play in the Unity editor and it will start as a client
  5. The error should get logged in the unity editor console

Example File
DebugManagerError.zip

Video

Unity_vyuO0QiPWw.mp4
@FirstGearGames FirstGearGames added the Bug Something isn't working label Apr 6, 2024
@FirstGearGames FirstGearGames added Working as Intended and removed Bug Something isn't working labels May 4, 2024
@FirstGearGames
Copy link
Owner

FirstGearGames commented May 4, 2024

There was no error displayed when building as development mode. The DebugManager is non-functioning when building as release. So the client is expecting debug, but the server is not sending it as intended. Let me know if I'm missing anything!

@athpon
Copy link

athpon commented May 4, 2024

The bug is happen in release build connect to a development build.

https://discord.com/channels/424284635074134018/1034477094731784302/1231127923050680330

@athpon
Copy link

athpon commented May 4, 2024

FishNet.Managing.Object.ManagedObjects.WriteSpawn_Server(NetworkObject nob, NetworkConnection connection, Writer writer)
#if DEVELOPMENT //Check to write additional information if a scene object. if (NetworkManager.DebugManager.WriteSceneObjectDetails) { headerWriter.WriteString(nob.gameObject.scene.name); headerWriter.WriteString(nob.gameObject.name); } #endif
FishNet.Managing.Client.ClientObjects.WriteSpawn_Client(NetworkObject nob, Writer writer)
if (sceneObject) { headerWriter.WriteUInt64(nob.SceneId, AutoPackType.Unpacked); #if DEVELOPMENT base.CheckWriteSceneObjectDetails(nob, headerWriter); #endif }

Reader
FishNet.Managing.Client.ClientObjects.CacheSpawn(PooledReader reader)
if (sceneObject) { ReadSceneObject(reader, out sceneId); #if UNITY_EDITOR || DEVELOPMENT_BUILD base.CheckReadSceneObjectDetails(reader, ref sceneName, ref objectName); #endif }

Notice the different in reading and writing ? The #if is different and does not cover the case release build connect to dev build.
If different build connect is an intended behaviour, At least it should be noted somewhere ?

Here's where it wrote packet in picture
image
image

Here's where it read
image

I'm actually not sure if there's more issue similar to this case where like 'working in editor but outright fail in release build'
"just build two release build" should be the solution but no, I think there's more issue in dedicated server build.

@FirstGearGames
Copy link
Owner

FirstGearGames commented May 4, 2024 via email

@athpon
Copy link

athpon commented May 4, 2024

Alright If you said so, But to prevent this issue there should be some error printing when client connect and on a different build that hey this is not supported, should save a lot of frustration/time.

@FirstGearGames
Copy link
Owner

FirstGearGames commented May 4, 2024

I agree. I was actually thinking about this moments after your previous comment. I've done just this for the FishNet version in the next release, I can piggyback off the same code for this too.

@FirstGearGames
Copy link
Owner

Added and tested working in next release, 4.3.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants