BLOB 1.1.0
See the version list below for details.
dotnet add package BLOB --version 1.1.0
NuGet\Install-Package BLOB -Version 1.1.0
<PackageReference Include="BLOB" Version="1.1.0" />
<PackageVersion Include="BLOB" Version="1.1.0" />
<PackageReference Include="BLOB" />
paket add BLOB --version 1.1.0
#r "nuget: BLOB, 1.1.0"
#:package BLOB@1.1.0
#addin nuget:?package=BLOB&version=1.1.0
#tool nuget:?package=BLOB&version=1.1.0
BLOB
An alternative way to build BLOB for both Unity.Entities and .NET.
Usage
Builder
<table>
<tr> <td align="center"><strong>BLOB Type</strong></td> <td align="center"><strong>com.quabug.BLOB</strong></td> <td align="center"><strong>Unity.Entities</strong></td> </tr>
<tr> <td> <sub>
int
</sub>
</td>
<td>
<sub>
var builder = new ValueBuilder<int>(1);
var blob = builder.CreateManagedBlobAssetReference();
Assert.That(blob.Value, Is.EqualTo(1));
</sub> </td> <td> <sub>
var builder = new BlobBuilder(Allocator.Temp);
builder.ConstructRoot<int>() = 1;
var blob = builder.CreateBlobAssetReference<int>(Allocator.Temp);
Assert.That(blob.Value, Is.EqualTo(1));
</sub> </td> </tr>
<tr> <td> <sub>
BlobArray<int>
</sub>
</td>
<td>
<sub>
var builder = new ArrayBuilder<int>(new [] { 1, 2, 3 });
var blob = builder.CreateManagedBlobAssetReference();
Assert.That(blob.Value.ToArray(), Is.EquivalentTo(new[]{1,2,3}));
</sub> </td> <td> <sub>
var builder = new BlobBuilder(Allocator.Temp);
ref var intArray = ref builder.ConstructRoot<BlobArray<int>>();
var intArrayBuilder = builder.Allocate(ref intArray, 3);
for (var i = 0; i < 3; i++) intArrayBuilder[i] = i + 1;
var blob = builder.CreateBlobAssetReference<BlobArray<int>>(Allocator.Temp);
Assert.That(blob.Value.ToArray(), Is.EquivalentTo(new[]{1,2,3}));
</sub> </td> </tr>
<tr> <td> <sub>
BlobString
</sub>
</td>
<td>
<sub>
var builder = new StringBuilder<UTF8Encoding>("123");
var blob = builder.CreateManagedBlobAssetReference();
Assert.That(blob.Value.ToString(), Is.EquivalentTo("123"));
</sub> </td> <td> <sub>
var builder = new BlobBuilder(Allocator.Temp);
ref var blobString = ref builder.ConstructRoot<BlobString>();
builder.AllocateString(ref blobString, "123");
var blob = builder.CreateBlobAssetReference<BlobString>(Allocator.Temp);
Assert.That(blob.Value.ToString(), Is.EquivalentTo("123"));
</sub> </td> </tr>
<tr> <td> <sub>
BlobPtr<int>
</sub>
</td>
<td>
<sub>
var builder = new PtrBuilderWithNewValue<int>(1);
var blob = builder.CreateManagedBlobAssetReference();
Assert.That(blob.Value.Value, Is.EqualTo(1));
</sub> </td> <td> <sub>
var builder = new BlobBuilder(Allocator.Temp);
ref var intPtr = ref builder.ConstructRoot<BlobPtr<int>>();
builder.Allocate(ref intPtr) = 1;
var blob = builder.CreateBlobAssetReference<BlobPtr<int>>(Allocator.Temp);
Assert.That(blob.Value.Value, Is.EqualTo(1));
</sub> </td> </tr>
<tr> <td> <sub>
struct IntPtr
{
int Int;
BlobPtr<int> Ptr;
}
</sub> </td> <td> <sub>
var builder = new PtrBuilderWithNewValue<int>(1);
var blob = builder.CreateManagedBlobAssetReference();
Assert.That(blob.Value.Value, Is.EqualTo(1));
</sub> </td> <td> <sub>
var builder = new BlobBuilder(Allocator.Temp);
ref var intPtr = ref builder.ConstructRoot<IntPtr>();
intPtr.Int = 1;
builder.SetPointer(ref intPtr.Ptr, ref intPtr.Int);
var blob = builder.CreateBlobAssetReference<IntPtr>(Allocator.Temp);
Assert.That(blob.Value.Int, Is.EqualTo(1));
Assert.That(blob.Value.Ptr.Value, Is.EqualTo(1));
</sub> </td> </tr>
<tr> <td> <sub>
struct PtrPtr
{
BlobPtr<int> Ptr1;
BlobPtr<int> Ptr2;
}
</sub> </td> <td> <sub>
var builder = new StructBuilder<PtrPtr>();
var ptrBuilder = builder.SetPointer(ref builder.Value.Ptr1, 1);
builder.SetPointer(ref builder.Value.Ptr2, ptrBuilder.ValueBuilder);
var blob = builder.CreateManagedBlobAssetReference();
Assert.That(blob.Value.Ptr1.Value, Is.EqualTo(1));
Assert.That(blob.Value.Ptr2.Value, Is.EqualTo(1));
</sub> </td> <td> <sub>
var builder = new BlobBuilder(Allocator.Temp);
ref var ptrPtr = ref builder.ConstructRoot<PtrPtr>();
ref var ptrValue = ref builder.Allocate(ref ptrPtr.Ptr1);
ptrValue = 1;
builder.SetPointer(ref ptrPtr.Ptr2, ref ptrValue);
var blob = builder.CreateBlobAssetReference<PtrPtr>(Allocator.Temp);
Assert.That(blob.Value.Ptr1.Value, Is.EqualTo(1));
Assert.That(blob.Value.Ptr2.Value, Is.EqualTo(1));
</sub> </td> </tr>
<tr> <td> <sub>
using BlobString =
BlobString<UTF8Encoding>;
struct Blob
{
int Int;
BlobString String;
BlobPtr<BlobString> PtrString;
BlobArray<int> IntArray;
}
</sub> </td> <td> <sub>
var builder = new StructBuilder<Blob>();
builder.SetValue(ref builder.Value.Int, 1);
var stringBuilder = builder.SetString(ref builder.Value.String, "123");
builder.SetPointer(ref builder.Value.PtrString, stringBuilder);
builder.SetArray(ref builder.Value.IntArray, new[] { 1, 2, 3 });
var blob = builder.CreateManagedBlobAssetReference();
Assert.That(blob.Value.Int, Is.EqualTo(1));
Assert.That(blob.Value.String.ToString(), Is.EqualTo("123"));
Assert.That(blob.Value.PtrString.Value.ToString(), Is.EqualTo("123"));
Assert.That(blob.Value.IntArray.ToArray(), Is.EqualTo(new[]{1,2,3}));
</sub> </td> <td> <sub>
var builder = new BlobBuilder(Allocator.Temp);
ref var root = ref builder.ConstructRoot<Blob>();
root.Int = 1;
builder.AllocateString(ref root.String, "123");
builder.SetPointer(ref root.PtrString, ref root.String);
var intArrayBuilder = builder.Allocate(ref root.IntArray, 3);
for (var i = 0; i < 3; i++) intArrayBuilder[i] = i + 1;
var blob = builder.CreateBlobAssetReference<Blob>(Allocator.Temp);
Assert.That(blob.Value.Int, Is.EqualTo(1));
Assert.That(blob.Value.String.ToString(), Is.EqualTo("123"));
Assert.That(blob.Value.PtrString.Value.ToString(), Is.EqualTo("123"));
Assert.That(blob.Value.IntArray.ToArray(), Is.EqualTo(new [] {1, 2, 3}));
</sub> </td> </tr> </table>
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- JetBrains.Annotations (>= 2021.3.0)
-
.NETStandard 2.1
- JetBrains.Annotations (>= 2021.3.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.