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

When crossing assemblies, you may not be able to obtain the Reader/Writer defined by yourself. #3816

Open
pepoipod opened this issue Apr 26, 2024 · 0 comments

Comments

@pepoipod
Copy link

pepoipod commented Apr 26, 2024

Describe the bug
ReaderWriterProcessor registers a custom Reader/Writer included in AssemblyReferences of CurrentAssembly.
However, in a complicated case, when a NetworkMessage contained in AssemblyReferences requires a Reader/Writer that is not contained in its CurrentAssembly.AssemblyReferences, Reader<T>.read contains the one generated with Readers.GenerateClassOrStructReadFunction() will be inserted.

[IMPORTANT] How can we reproduce the issue, step by step:

  1. Create assembly A. Here we define a simple record and a custom Reader/Writer. By using { get; set; }, Readers.GenerateClassOrStructReadFunction() will not insert a value, making it easier to test.
  2. Create assembly B. Create a NetworkMessage here and set the record created in assembly A to the property.
  3. Create assembly C. References assembly B only. Write code that appropriately references NetworkMessage in C. Without this, it seems that it is not included in CurrentAssembly.AssemblyReferences.
  4. Create a new class in assembly B that inherits NetworkBehaviour. Add SyncList to the properties. The server adds a random value to the SyncList during Update, etc.
  5. Start two Unity app using PararelSync etc. and check the behavior on Server / Client. The Count of SyncList is increasing and the contents are also increasing, but the value received by the Client is always the initial value.

Expected behavior
The value incremented by SyncList must be set correctly.

Desktop (please complete the following information):

  • OS: Windows
  • Build target: Windows
  • Unity version: 2022.3.23f1
  • Mirror branch: master

Additional context
I fixed this issue locally. also ready to submit a PullRequest. If you don't mind, could you add me as a contributor?

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

No branches or pull requests

1 participant