Unclaimed Package Is this your package? Claim it to unlock full analytics and manage your listing.
Claim This Package

Install via UPM

Add to Unity Package Manager using this URL

https://www.pkglnk.dev/track/managed-jobs.git

README

Managed Jobs

openupm

Use classes and other managed types with Unity's C# Job System.

The Job System only accepts blittable struct types for jobs. This package makes it easy to use managed types as jobs by providing blittable structs that reference managed objects using GCHandle and forward job execution to them.

Features

  • Easily schedule jobs implemented by class types, as well as struct types with managed fields
  • Schedule managed IJob types using ManagedJob
  • Schedule managed IJobFor types using ManagedJobFor
  • Schedule managed IJobParallelFor types using ManagedJobParallelFor
  • Schedule managed IJobParallelForTransform types using ManagedJobParallelForTransform
  • Automatic disposal of the allocated GCHandle if you call Schedule / Run methods and their variations directly on the wrapper structs

Caveats

  • Managed jobs are not compatible with Burst

Installing

Either:

  • Use the openupm registry and install this package using the openupm-cli:
    openupm add com.gilzoide.managed-jobs
    
  • Install via Unity Package Manager using this repository URL and tag:
    https://github.com/gilzoide/unity-managed-jobs.git#1.0.0
    
  • Clone this repository directly inside your project's Assets or Packages folder.

Basic Usage

using Unity.Jobs;
using Gilzoide.ManagedJobs;

// 1. Create your managed job type
public class MyManagedJobClass : IJob
{
    public string Message = "Fields with managed types are supported!";

    public void Execute()
    {
        Debug.Log($"Job is being executed! Here's the message: '{Message}'");
    }
}

// 2. Schedule the job by using the wrapper ManagedJob struct type
var myManagedJobObject = new MyManagedJobClass();
var jobHandle = new ManagedJob(myManagedJobObject).Schedule();
// 3. Complete the jobHandle or use it as dependency to other jobs as usual
jobHandle.Complete();

// 4. Enjoy 🍾
Total Installs
0
Last 30 days
Unique IPs
0
Approximate users

Installs Over Time

Operating Systems

No data yet

Top Countries

No data yet

Git Versions

No data yet

Embed Install Badge

Add an install count badge to your README

Style
Preview
pkglnk installs badge
Markdown
[![pkglnk installs](https://www.pkglnk.dev/badge/managed-jobs.svg?style=pkglnk)](https://www.pkglnk.dev/pkg/managed-jobs)
HTML
<a href="https://www.pkglnk.dev/pkg/managed-jobs"><img src="https://www.pkglnk.dev/badge/managed-jobs.svg?style=pkglnk" alt="pkglnk installs"></a>

Comments

No comments yet. Be the first!