Created
March 16, 2022 21:21
-
-
Save neuecc/1871f450a897c5783daa956fb6547f0d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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