Skip to content

Instantly share code, notes, and snippets.

@neuecc
Created March 16, 2022 21:21
Show Gist options
  • Select an option

  • Save neuecc/1871f450a897c5783daa956fb6547f0d to your computer and use it in GitHub Desktop.

Select an option

Save neuecc/1871f450a897c5783daa956fb6547f0d to your computer and use it in GitHub Desktop.
public class DFrameWorker : MonoBehaviour
{
DFrameWorkerApp app;
[RuntimeInitializeOnLoadMethod]
static void Init()
{
new GameObject("DFrame Worker", typeof(SampleOne));
}
private void Awake()
{
DontDestroyOnLoad(gameObject);
}
async void Start()
{
// setup your controller address
app = new DFrameWorkerApp("localhost:7313");
await app.RunAsync();
}
private void OnDestroy()
{
app.Dispose();
}
}
[Preserve]
public class SampleWorkload : Workload
{
public override Task ExecuteAsync(WorkloadContext context)
{
Debug.Log("Exec");
return Task.CompletedTask;
}
public override Task TeardownAsync(WorkloadContext context)
{
Debug.Log("Teardown");
return Task.CompletedTask;
}
}
// Preserve for Unity IL2CPP
internal class PreserveAttribute : System.Attribute
{
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment