Unity-Technologies / multiplayer-community-contributions

Community contributions to Unity Multiplayer Networking products and services.
MIT License
421 stars 161 forks source link

fix: port NetworkDictionary to 1.0.0 (stable) #178

Closed WhippetsAintDogs closed 1 year ago

WhippetsAintDogs commented 2 years ago

internal static void Write and internal static void Read methods of the public static class NetworkVariableSerialization<T> (NetworkVariableSerialization.cs) of the NGO's package have to be made public in order to make this implementation work.

OR

You can add an Assembly definition reference (.asmref) next to this file pointing to the NGO's package. It'll make Unity consider this file as it was part of the NGO's package and effectively give it access to all NGO's internal methods.

WhippetsAintDogs commented 2 years ago

To make this feature work out of the box, we could update this repo's dependency to NGO to 1.0.0 (stable) and actually add the assembly definition reference file I've mentionned in the previous comment. What do you think about that, guys ?

PrarR commented 1 year ago

Some clarification of the @WhippetsAintDogs solution as it may not be entirely clear - create e.g. folder "NetworkDictionary" in your solution in Scripts folder. Move NetworkDictionary.cs class there and create NetworkDictionary.asmref with this code:

{ "reference": "Unity.Netcode.Runtime" }

or via Unity Editor:

obraz

It may not be the best solution, but it works for me. Thanks @WhippetsAintDogs for your pull request. Thanks to you I didn't get a headache while solving this problem! :)

JesseOlmer commented 1 year ago

@PrarR @WhippetsAintDogs these comments are great, but once this is merged no one will see them. Maybe add them as a README.md in the NetworkDictionary folder? Would also be great if NetworkDictionary would be conditionally compiled (disabled by default) so that there are no compile errors as soon as people install the package. Right now when people install the package they are forced to take action and fix NetworkDictionary even if they're not using it :shrug:

WhippetsAintDogs commented 1 year ago

@JesseOlmer it's done ! 😄