A collection of Unity libraries for client modders to make writing efficient, allocation-free code easier.
UnityToolkit
What is this library for?
This library aims to provide additional tools to client modders which will (hopefully) allow them to write more optimised code and reduce the performance cost and memory allocation of their code even further.
How to install this library (for users)
- Download the latest release
- Open the .7z with 7-Zip
- Drag and drop the ‘BepInEx’ folder into your game folder
- Play SPT
How to use this library (for mod developers):
- Download the latest release
- Copy the assemblies from the release zip to where you store your project’s assembly references
- Add all the assemblies as assembly references to your project
- Add
[BepInDependency("com.arys.unitytoolkit")]attribute to your plugin class (I recommend you add a minimum version string to the attribute) - You can now use UniTask, Unity.Collections, VContainer, ZLinq and ZString in your mod
What features does this library provide?
- UniTask is a near zero-allocating, performant version of C# Tasks that’s suited for Unity than the standard C# implementation
- It doesn’t use threads or
SynchronizationContext/ExecutionContextso the result is faster performance and lower allocation while matching Unity threading (single-thread) - It is also possible to replace Unity’s Coroutines, which has poor performance and higher memory allocation, with UniTask instead
- Documentation: https://github.com/Cysharp/UniTask
- It doesn’t use threads or
- Unity.Collections is included in this library for the additional
NativeContainertypes it providesNativeList,NativeHashMap,NativeMultiHashMap, andNativeQueue: these are useful data types when you are working with Unity’s Jobs system as they are thread-safe- Documentation: https://docs.unity3d.com/Packages/[email protected]/manual/collections-overview.html
- VContainer is a fast Dependency Injection container, designed for Unity and works with injecting into both standard C# classes and Unity MonoBehaviours
- Documentation: https://vcontainer.hadashikick.jp
- ZLinq provides high performance, zero-allocation LINQ by utilising
ValueEnumerable, made by the developer of UniTask- Documentation: https://github.com/Cysharp/ZLinq
- ZString is a near zero-allocating string builder, which is also made by the developer of UniTask and ZLinq
- Documentation: https://github.com/Cysharp/ZString
Also included:
- FixPluginTypesSerialization is a patcher that fixes custom classes/structs with the
[System.Serializable]attribute not being deserialized properly for BepInEx plugins- Thanks to Tarkin for discovering this bug and the fix
Is it safe?
Yes, all assemblies are just compiled versions of their original git repo I’ve also included a VirusTotal scan of all assemblies on the GitHub releases page
Building from source
- Clone the repository:
git clone https://github.com/Nympfonic/UnityToolkit.git - Place the compiled assemblies for UniTask, Unity.Collections and ZString in
project\UnityToolkit\References. - Adjust the reference paths, macros and build events in the .csproj files
- Open solution in your preferred C# IDE
- Build solution
489.02 KB
542 Downloads
In this release
- Removed redundant code
- Removed FixPluginTypesSerialization
- Unfortunately this plugin caused conflicts with some other mods so the decision was made to remove it
519.99 KB
286 Downloads
WARNING
There is an issue with this release which causes the game to fail to load into the main menu with certain mods installed.
Please remove the “FixPluginTypeSerialization” folder inside the “BepInEx/patchers” folder!
After discussion with Tarkin, this patcher will be removed in the next update of UnityToolkit and he will provide a fixed version of that patcher in his upcoming mod.
In this release
- Removed all APIs and extension methods
- They were not up to par and were probably only used by myself
- Added VContainer
- A fast dependency injection container designed for Unity, so it also works on injecting into Unity Objects
- Added ZLinq
- Adds high performance, zero-allocation LINQ by using
ValueEnumerable
- Adds high performance, zero-allocation LINQ by using
- Added FixPluginTypesSerialization
- Fixes a bug that affects all Unity Engine versions where references to custom
[System.Serializable]classes/structs would not be deserialized correctly in Unity Objects added by client mods - Thanks to Tarkin for finding this fix
- Fixes a bug that affects all Unity Engine versions where references to custom
33.0K Downloads
Added Dependency Injection Container and Event Bus structures for mod developers
26.4K Downloads
New in this release
- Fixed issue where UniTask’s PlayerLoopSystem was not being injected correctly
- Updated UniTask from v2.5.5 to v2.5.10
- Added ZString v2.4.4 as a near zero-allocation string builder alternative
- Added new structures: Closure<TContext>, ObjectPool<T>, and IProcessor<TProcessor, TData>
- Added a new ModulePatchManager class which can be used in your client mod plugin to automatically enable your mod patches
See details in the release notes: https://github.com/Nympfonic/UnityToolkit/releases/tag/v1.1.0
144.7K Downloads
Updated UniTask from v2.5.4 to v2.5.5
2.7K Downloads
Initial release
Details
-
GUID
com.arys.unitytoolkit
-
Category
-
License
-
Source Code
-
Latest Version VirusTotal Result
WARNING
There is an issue with v2.0.0 release which causes the game to fail to load into the main menu with certain mods installed.
Solution: Please delete the “FixPluginTypesSerialization” folder inside the “BepInEx/patchers” folder.
After following the above solution, you may also update to v2.0.1
Sorry for the inconvenience!
挖矿.exe restart the server ? is that a joke ?
omg update for 4.0 spt, im dreaming?
Is there any way to use this mod on 3.11? I need him urgently. Maybe just replace some number in the file?
As of now causes infinite Loading. (3.11)
Just wanted to say.
Spt 3.9.5 is telling me it can’t find the unityplayer.dll, it is in the bepinex folder, is that where it belongs?
Does the UnityToolkit 1.0.1 work with 3.8.3 still?