Setup MemoryPack in Unity
mainMemoryPack requires Unity version 2022.3.12f1 or higher. Follow these steps for installation:
- Install Core Package: Use NuGetForUnity to install
MemoryPackfrom NuGet.- Note: If you encounter version conflicts, disable "Assembly Version Validation" in Project Settings > Player > Other Settings.
- Install Unity Extensions: Add the
MemoryPack.Unitypackage via Git URL:https://github.com/Cysharp/MemoryPack.git?path=src/MemoryPack.Unity/Assets/MemoryPack.Unity- You can specify a version using the
#suffix, e.g.,#1.0.0.
- You can specify a version using the
- Unity-Specific Types: For shared code containing Unity types (like
Vector3), install theMemoryPack.UnityShimsNuGet package.
Limitations in Unity:
CustomFormatteris not supported.- Binary format is not fully compatible with .NET 7+ if using
[StructLayout(LayoutKind.Auto)]on value types likeDateTimeOffsetorValueTuple. Avoid these types for cross-platform compatibility.