Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
EasySync
Configuration syncing made easy, thanks to CSync by Owen3H.
| Date uploaded | 2 years ago |
| Version | 0.0.1 |
| Download link | Dreadrith-EasySync-0.0.1.zip |
| Downloads | 358 |
| Dependency string | Dreadrith-EasySync-0.0.1 |
This mod requires the following mods to function
BepInEx-BepInExPack
BepInEx pack for Mono Unity games. Preconfigured and ready to use.
Preferred version: 5.4.2100README
If this actually gets some use maybe I'll write some better documentation. I hate documenting :(
What is this
TLDR: Small cursed code that makes config syncing a one liner so that you don't copy paste.
Some cursed code that deals with reflection to be able to handle CSync's requirement for generic types. Static members are not one and the same in generic types and one exists for each generic type. Using reflection, it grabs the members needed for CSync's functionality and handle it the same way so that there isn't the same static code for each different class that uses CSync's SyncedInstance class.
How To Use
How the heck do I even write a wiki?
- Add CSync and EasySync as references.
- Follow CSync's wiki for step 1-2.
- In the constructor, replace
InitInstance(this);withEasySync.SyncManager.RegisterForSyncing(this, GUID);. - Done. Yep that's all. Your config should now sync whenever someone joins the server.
Extra notes
- GUID could be your
PluginInfo.PLUGIN_GUID. Just any string that is unique enough to not be used by others mistakenly. - The new method will return a
SyncedInstanceContainer. It's only useful you need to resync the settings with your code usingcontainer.RequestSync()for whatever reason. - You can stop your config from syncing by using
EasySync.SyncManager.UnregisterFromSyncing(GUID)but currently that only stops it from syncing automatically on player joins.