diff --git a/.docfx/api/ComponentTask.Exceptions.ComponentTaskCanceledException.yml b/.docfx/api/ComponentTask.Exceptions.ComponentTaskCanceledException.yml index 23c37ff..86b582d 100644 --- a/.docfx/api/ComponentTask.Exceptions.ComponentTaskCanceledException.yml +++ b/.docfx/api/ComponentTask.Exceptions.ComponentTaskCanceledException.yml @@ -15,7 +15,7 @@ items: source: id: ComponentTaskCanceledException path: '' - startLine: 2168 + startLine: 2180 assemblies: - cs.temp.dll namespace: ComponentTask.Exceptions diff --git a/.docfx/api/ComponentTask.Exceptions.ContextChangedException.yml b/.docfx/api/ComponentTask.Exceptions.ContextChangedException.yml index 659dbaa..281f8e8 100644 --- a/.docfx/api/ComponentTask.Exceptions.ContextChangedException.yml +++ b/.docfx/api/ComponentTask.Exceptions.ContextChangedException.yml @@ -15,7 +15,7 @@ items: source: id: ContextChangedException path: '' - startLine: 2151 + startLine: 2163 assemblies: - cs.temp.dll namespace: ComponentTask.Exceptions diff --git a/.docfx/api/ComponentTask.Exceptions.InactiveComponentException.yml b/.docfx/api/ComponentTask.Exceptions.InactiveComponentException.yml index 4750fbf..3ff90bd 100644 --- a/.docfx/api/ComponentTask.Exceptions.InactiveComponentException.yml +++ b/.docfx/api/ComponentTask.Exceptions.InactiveComponentException.yml @@ -15,7 +15,7 @@ items: source: id: InactiveComponentException path: '' - startLine: 2067 + startLine: 2079 assemblies: - cs.temp.dll namespace: ComponentTask.Exceptions diff --git a/.docfx/api/ComponentTask.Exceptions.InactiveGameObjectException.yml b/.docfx/api/ComponentTask.Exceptions.InactiveGameObjectException.yml index 1ffcef3..f64c5a6 100644 --- a/.docfx/api/ComponentTask.Exceptions.InactiveGameObjectException.yml +++ b/.docfx/api/ComponentTask.Exceptions.InactiveGameObjectException.yml @@ -15,7 +15,7 @@ items: source: id: InactiveGameObjectException path: '' - startLine: 2100 + startLine: 2112 assemblies: - cs.temp.dll namespace: ComponentTask.Exceptions diff --git a/.docfx/api/ComponentTask.Exceptions.NonUnityThreadException.yml b/.docfx/api/ComponentTask.Exceptions.NonUnityThreadException.yml index ed804b2..52fbf73 100644 --- a/.docfx/api/ComponentTask.Exceptions.NonUnityThreadException.yml +++ b/.docfx/api/ComponentTask.Exceptions.NonUnityThreadException.yml @@ -15,7 +15,7 @@ items: source: id: NonUnityThreadException path: '' - startLine: 2117 + startLine: 2129 assemblies: - cs.temp.dll namespace: ComponentTask.Exceptions diff --git a/.docfx/api/ComponentTask.Exceptions.NotPlayingException.yml b/.docfx/api/ComponentTask.Exceptions.NotPlayingException.yml index dfe4159..a4fd156 100644 --- a/.docfx/api/ComponentTask.Exceptions.NotPlayingException.yml +++ b/.docfx/api/ComponentTask.Exceptions.NotPlayingException.yml @@ -15,7 +15,7 @@ items: source: id: NotPlayingException path: '' - startLine: 2084 + startLine: 2096 assemblies: - cs.temp.dll namespace: ComponentTask.Exceptions diff --git a/.docfx/api/ComponentTask.Exceptions.TaskCreatorReturnedNullException.yml b/.docfx/api/ComponentTask.Exceptions.TaskCreatorReturnedNullException.yml index 9d18af0..4fc1de7 100644 --- a/.docfx/api/ComponentTask.Exceptions.TaskCreatorReturnedNullException.yml +++ b/.docfx/api/ComponentTask.Exceptions.TaskCreatorReturnedNullException.yml @@ -15,7 +15,7 @@ items: source: id: TaskCreatorReturnedNullException path: '' - startLine: 2133 + startLine: 2145 assemblies: - cs.temp.dll namespace: ComponentTask.Exceptions diff --git a/.docfx/install.md b/.docfx/install.md index 9cc3de9..0c79c17 100644 --- a/.docfx/install.md +++ b/.docfx/install.md @@ -23,4 +23,4 @@ commit. ### Upgrading To update to a newer version simply open your package manifest (`Packages/manifest.json`) and set -the tag at the end of the git url (for example `v1.8.1`) to a later version. +the tag at the end of the git url (for example `v1.8.2`) to a later version. diff --git a/docs/api/ComponentTask.Config.html b/docs/api/ComponentTask.Config.html index 2bd6107..189f536 100644 --- a/docs/api/ComponentTask.Config.html +++ b/docs/api/ComponentTask.Config.html @@ -10,7 +10,7 @@ - + diff --git a/docs/api/ComponentTask.Exceptions.ComponentTaskCanceledException.html b/docs/api/ComponentTask.Exceptions.ComponentTaskCanceledException.html index 8b041ed..ed02f2b 100644 --- a/docs/api/ComponentTask.Exceptions.ComponentTaskCanceledException.html +++ b/docs/api/ComponentTask.Exceptions.ComponentTaskCanceledException.html @@ -10,7 +10,7 @@ - + diff --git a/docs/api/ComponentTask.Exceptions.ContextChangedException.html b/docs/api/ComponentTask.Exceptions.ContextChangedException.html index a265506..ad8a242 100644 --- a/docs/api/ComponentTask.Exceptions.ContextChangedException.html +++ b/docs/api/ComponentTask.Exceptions.ContextChangedException.html @@ -10,7 +10,7 @@ - + diff --git a/docs/api/ComponentTask.Exceptions.InactiveComponentException.html b/docs/api/ComponentTask.Exceptions.InactiveComponentException.html index 91da38c..8f15d65 100644 --- a/docs/api/ComponentTask.Exceptions.InactiveComponentException.html +++ b/docs/api/ComponentTask.Exceptions.InactiveComponentException.html @@ -10,7 +10,7 @@ - + diff --git a/docs/api/ComponentTask.Exceptions.InactiveGameObjectException.html b/docs/api/ComponentTask.Exceptions.InactiveGameObjectException.html index 9c5d565..02e6ef4 100644 --- a/docs/api/ComponentTask.Exceptions.InactiveGameObjectException.html +++ b/docs/api/ComponentTask.Exceptions.InactiveGameObjectException.html @@ -10,7 +10,7 @@ - + diff --git a/docs/api/ComponentTask.Exceptions.NonUnityThreadException.html b/docs/api/ComponentTask.Exceptions.NonUnityThreadException.html index 4cf2b67..1e3da51 100644 --- a/docs/api/ComponentTask.Exceptions.NonUnityThreadException.html +++ b/docs/api/ComponentTask.Exceptions.NonUnityThreadException.html @@ -10,7 +10,7 @@ - + diff --git a/docs/api/ComponentTask.Exceptions.NotPlayingException.html b/docs/api/ComponentTask.Exceptions.NotPlayingException.html index 91747bb..4f0be40 100644 --- a/docs/api/ComponentTask.Exceptions.NotPlayingException.html +++ b/docs/api/ComponentTask.Exceptions.NotPlayingException.html @@ -10,7 +10,7 @@ - + diff --git a/docs/api/ComponentTask.Exceptions.TaskCreatorReturnedNullException.html b/docs/api/ComponentTask.Exceptions.TaskCreatorReturnedNullException.html index 2ac5704..14e6cf9 100644 --- a/docs/api/ComponentTask.Exceptions.TaskCreatorReturnedNullException.html +++ b/docs/api/ComponentTask.Exceptions.TaskCreatorReturnedNullException.html @@ -10,7 +10,7 @@ - + diff --git a/docs/api/ComponentTask.Exceptions.html b/docs/api/ComponentTask.Exceptions.html index 7049485..7454958 100644 --- a/docs/api/ComponentTask.Exceptions.html +++ b/docs/api/ComponentTask.Exceptions.html @@ -10,7 +10,7 @@ - + diff --git a/docs/api/ComponentTask.IDiagnosticLogger.html b/docs/api/ComponentTask.IDiagnosticLogger.html index 55f7262..ee8d902 100644 --- a/docs/api/ComponentTask.IDiagnosticLogger.html +++ b/docs/api/ComponentTask.IDiagnosticLogger.html @@ -10,7 +10,7 @@ - + diff --git a/docs/api/ComponentTask.IExceptionHandler.html b/docs/api/ComponentTask.IExceptionHandler.html index 398b369..d1d606a 100644 --- a/docs/api/ComponentTask.IExceptionHandler.html +++ b/docs/api/ComponentTask.IExceptionHandler.html @@ -10,7 +10,7 @@ - + diff --git a/docs/api/ComponentTask.ITaskRunner.html b/docs/api/ComponentTask.ITaskRunner.html index 3a2beae..5c91486 100644 --- a/docs/api/ComponentTask.ITaskRunner.html +++ b/docs/api/ComponentTask.ITaskRunner.html @@ -10,7 +10,7 @@ - + diff --git a/docs/api/ComponentTask.LocalTaskRunner.html b/docs/api/ComponentTask.LocalTaskRunner.html index 04b25df..a7c4f85 100644 --- a/docs/api/ComponentTask.LocalTaskRunner.html +++ b/docs/api/ComponentTask.LocalTaskRunner.html @@ -10,7 +10,7 @@ - + diff --git a/docs/api/ComponentTask.html b/docs/api/ComponentTask.html index 718d798..e20a250 100644 --- a/docs/api/ComponentTask.html +++ b/docs/api/ComponentTask.html @@ -10,7 +10,7 @@ - + diff --git a/docs/api/UnityEngine.ComponentExtensions.html b/docs/api/UnityEngine.ComponentExtensions.html index 661c6b6..6faf0e5 100644 --- a/docs/api/UnityEngine.ComponentExtensions.html +++ b/docs/api/UnityEngine.ComponentExtensions.html @@ -10,7 +10,7 @@ - + diff --git a/docs/api/UnityEngine.GameObjectExtensions.html b/docs/api/UnityEngine.GameObjectExtensions.html index 83f4293..1077cfd 100644 --- a/docs/api/UnityEngine.GameObjectExtensions.html +++ b/docs/api/UnityEngine.GameObjectExtensions.html @@ -10,7 +10,7 @@ - + diff --git a/docs/api/UnityEngine.TaskExtensions.html b/docs/api/UnityEngine.TaskExtensions.html index 5fb34ce..c1ed05e 100644 --- a/docs/api/UnityEngine.TaskExtensions.html +++ b/docs/api/UnityEngine.TaskExtensions.html @@ -10,7 +10,7 @@ - + diff --git a/docs/api/UnityEngine.TaskRunOptions.html b/docs/api/UnityEngine.TaskRunOptions.html index 6eaf188..ec4bac4 100644 --- a/docs/api/UnityEngine.TaskRunOptions.html +++ b/docs/api/UnityEngine.TaskRunOptions.html @@ -10,7 +10,7 @@ - + diff --git a/docs/api/UnityEngine.html b/docs/api/UnityEngine.html index 6729c15..2e04711 100644 --- a/docs/api/UnityEngine.html +++ b/docs/api/UnityEngine.html @@ -10,7 +10,7 @@ - + diff --git a/docs/api/index.html b/docs/api/index.html index 78bcad8..1e5d9dc 100644 --- a/docs/api/index.html +++ b/docs/api/index.html @@ -8,7 +8,7 @@ Api Reference | ComponentTask - + diff --git a/docs/api/toc.html b/docs/api/toc.html index a5d6ea6..2b0d5a6 100644 --- a/docs/api/toc.html +++ b/docs/api/toc.html @@ -4,6 +4,7 @@
+
diff --git a/docs/examples.html b/docs/examples.html index 57b2874..d5fdae5 100644 --- a/docs/examples.html +++ b/docs/examples.html @@ -8,7 +8,7 @@ Examples | ComponentTask - + diff --git a/docs/how-to.html b/docs/how-to.html index e4441e0..f8cdc63 100644 --- a/docs/how-to.html +++ b/docs/how-to.html @@ -8,7 +8,7 @@ How To | ComponentTask - + diff --git a/docs/index.html b/docs/index.html index fdf7a11..fca5a87 100644 --- a/docs/index.html +++ b/docs/index.html @@ -8,7 +8,7 @@ ComponentTask-Unity | ComponentTask - + diff --git a/docs/index.json b/docs/index.json index 4d480c0..7c1eb45 100644 --- a/docs/index.json +++ b/docs/index.json @@ -1,84 +1,84 @@ { - "api/index.html": { - "href": "api/index.html", - "title": "Api Reference | ComponentTask", - "keywords": "Api Reference Main api lives in the ' ComponentTask ' namespace. And some extension methods live in the UnityEngine namespace. Reason for having those extension methods live in the UnityEngine namespace is that it avoids users having to add using directives and also makes the api more discoverable as it will show up in intellisense. To avoid cluttering the UnityEngine namespace as few as possibles types live there. Namespaces ComponentTask UnityEngine Source All source is available on Github ." - }, - "api/ComponentTask.Exceptions.NotPlayingException.html": { - "href": "api/ComponentTask.Exceptions.NotPlayingException.html", - "title": "Class NotPlayingException | ComponentTask", - "keywords": "Class NotPlayingException Exception that is thrown when an api that can only be called while 'Playing' is called in edit-mode. Inheritance System.Object System.Exception System.SystemException System.InvalidOperationException NotPlayingException Implements System.Runtime.Serialization.ISerializable System.Runtime.InteropServices._Exception Inherited Members System.Exception.GetBaseException() System.Exception.ToString() System.Exception.GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext) System.Exception.GetType() System.Exception.Message System.Exception.Data System.Exception.InnerException System.Exception.TargetSite System.Exception.StackTrace System.Exception.HelpLink System.Exception.Source System.Exception.HResult System.Exception.SerializeObjectState System.Object.Equals(System.Object) System.Object.Equals(System.Object, System.Object) System.Object.GetHashCode() System.Object.MemberwiseClone() System.Object.ReferenceEquals(System.Object, System.Object) Namespace : ComponentTask.Exceptions Assembly : cs.temp.dll.dll Syntax public sealed class NotPlayingException : InvalidOperationException, ISerializable, _Exception Implements System.Runtime.Serialization.ISerializable System.Runtime.InteropServices._Exception" - }, - "install.html": { - "href": "install.html", - "title": "Installation | ComponentTask", - "keywords": "Installation Add package Add a reference to this repository to your package dependencies ( Packages/manifest.json ) \"dependencies\": { \"com.bastianblokland.componenttask\": \"https://github.com/BastianBlokland/componenttask-unity.git#v1.8\", ... } Use the tag at the end to specify the version to use. Latest version: Avoid adding a git path without a tag as latest master is not guaranteed to be stable, also it will make package resolving non-deterministic as every time you resolve master it might be a different commit. Upgrading To update to a newer version simply open your package manifest ( Packages/manifest.json ) and set the tag at the end of the git url (for example v1.8.1 ) to a later version." - }, - "api/ComponentTask.LocalTaskRunner.html": { - "href": "api/ComponentTask.LocalTaskRunner.html", - "title": "Class LocalTaskRunner | ComponentTask", - "keywords": "Class LocalTaskRunner TaskRunner that you can 'tick' manually. Inheritance System.Object LocalTaskRunner Implements ITaskRunner System.IDisposable Inherited Members System.Object.Equals(System.Object) System.Object.Equals(System.Object, System.Object) System.Object.GetHashCode() System.Object.GetType() System.Object.MemberwiseClone() System.Object.ToString() System.Object.ReferenceEquals(System.Object, System.Object) Namespace : ComponentTask Assembly : cs.temp.dll.dll Syntax public sealed class LocalTaskRunner : ITaskRunner, IDisposable Constructors LocalTaskRunner(IExceptionHandler) Construct a new instance of the LocalTaskRunner class. Declaration public LocalTaskRunner(IExceptionHandler exceptionHandler) Parameters Type Name Description IExceptionHandler exceptionHandler Handler to use when exception occur in tasks. Methods AssertRunningTaskCount(Int32) Valid in 'DEBUG' only, useful for tests. Declaration public void AssertRunningTaskCount(int expectedCount) Parameters Type Name Description System.Int32 expectedCount Dispose() Declaration public void Dispose() Execute() Execute all the work that was 'scheduled' by the tasks running on this runner. Declaration public void Execute() StartTask(Func) Start a task on this runner. that is passed to the task-creator is cancelled when the runner is disposed, this can be usefull for cancelling external processes. Declaration public Task StartTask(Func taskCreator) Parameters Type Name Description System.Func < CancellationToken , System.Threading.Tasks.Task > taskCreator Function for creating the task. Returns Type Description System.Threading.Tasks.Task Task that completes when the original task completes or when the runner gets disposed. Exceptions Type Condition TaskCreatorReturnedNullException Thrown when null is returned from the 'taskCreator'. ComponentTaskCanceledException Thrown when awaiting a component-task that gets cancelled. Can happen if you are awaiting a component that gets destroyed. StartTask(Func, IDiagnosticLogger) Declaration public Task StartTask(Func taskCreator, IDiagnosticLogger logger) Parameters Type Name Description System.Func < CancellationToken , System.Threading.Tasks.Task > taskCreator IDiagnosticLogger logger Optional logger to output diagnostic messages to. Returns Type Description System.Threading.Tasks.Task StartTask(Func) Start a task on this runner. Declaration public Task StartTask(Func taskCreator) Parameters Type Name Description System.Func < System.Threading.Tasks.Task > taskCreator Function for creating the task. Returns Type Description System.Threading.Tasks.Task Task that completes when the original task completes or when the runner gets disposed. Exceptions Type Condition TaskCreatorReturnedNullException Thrown when null is returned from the 'taskCreator'. ComponentTaskCanceledException Thrown when awaiting a component-task that gets cancelled. StartTask(Func, IDiagnosticLogger) Declaration public Task StartTask(Func taskCreator, IDiagnosticLogger logger) Parameters Type Name Description System.Func < System.Threading.Tasks.Task > taskCreator IDiagnosticLogger logger Optional logger to output diagnostic messages to. Returns Type Description System.Threading.Tasks.Task StartTask(Func, TIn) Declaration public Task StartTask(Func taskCreator, TIn data) Parameters Type Name Description System.Func taskCreator TIn data Returns Type Description System.Threading.Tasks.Task Type Parameters Name Description TIn StartTask(Func, TIn, IDiagnosticLogger) Declaration public Task StartTask(Func taskCreator, TIn data, IDiagnosticLogger logger) Parameters Type Name Description System.Func taskCreator TIn data IDiagnosticLogger logger Optional logger to output diagnostic messages to. Returns Type Description System.Threading.Tasks.Task Type Parameters Name Description TIn StartTask(Func, TIn) Declaration public Task StartTask(Func taskCreator, TIn data) Parameters Type Name Description System.Func taskCreator TIn data Returns Type Description System.Threading.Tasks.Task Type Parameters Name Description TIn StartTask(Func, TIn, IDiagnosticLogger) Declaration public Task StartTask(Func taskCreator, TIn data, IDiagnosticLogger logger) Parameters Type Name Description System.Func taskCreator TIn data IDiagnosticLogger logger Optional logger to output diagnostic messages to. Returns Type Description System.Threading.Tasks.Task Type Parameters Name Description TIn StartTask(Func>) Declaration public Task StartTask(Func> taskCreator) Parameters Type Name Description System.Func < CancellationToken , System.Threading.Tasks.Task > taskCreator Returns Type Description System.Threading.Tasks.Task Type Parameters Name Description TOut StartTask(Func>, IDiagnosticLogger) Declaration public Task StartTask(Func> taskCreator, IDiagnosticLogger logger) Parameters Type Name Description System.Func < CancellationToken , System.Threading.Tasks.Task > taskCreator IDiagnosticLogger logger Optional logger to output diagnostic messages to. Returns Type Description System.Threading.Tasks.Task Type Parameters Name Description TOut StartTask(Func>) Declaration public Task StartTask(Func> taskCreator) Parameters Type Name Description System.Func < System.Threading.Tasks.Task > taskCreator Returns Type Description System.Threading.Tasks.Task Type Parameters Name Description TOut StartTask(Func>, IDiagnosticLogger) Declaration public Task StartTask(Func> taskCreator, IDiagnosticLogger logger) Parameters Type Name Description System.Func < System.Threading.Tasks.Task > taskCreator IDiagnosticLogger logger Optional logger to output diagnostic messages to. Returns Type Description System.Threading.Tasks.Task Type Parameters Name Description TOut StartTask(Func>, TIn) Declaration public Task StartTask(Func> taskCreator, TIn data) Parameters Type Name Description System.Func > taskCreator TIn data Returns Type Description System.Threading.Tasks.Task Type Parameters Name Description TIn TOut StartTask(Func>, TIn, IDiagnosticLogger) Declaration public Task StartTask(Func> taskCreator, TIn data, IDiagnosticLogger logger) Parameters Type Name Description System.Func > taskCreator TIn data IDiagnosticLogger logger Optional logger to output diagnostic messages to. Returns Type Description System.Threading.Tasks.Task Type Parameters Name Description TIn TOut StartTask(Func>, TIn) Declaration public Task StartTask(Func> taskCreator, TIn data) Parameters Type Name Description System.Func > taskCreator TIn data Returns Type Description System.Threading.Tasks.Task Type Parameters Name Description TIn TOut StartTask(Func>, TIn, IDiagnosticLogger) Declaration public Task StartTask(Func> taskCreator, TIn data, IDiagnosticLogger logger) Parameters Type Name Description System.Func > taskCreator TIn data IDiagnosticLogger logger Optional logger to output diagnostic messages to. Returns Type Description System.Threading.Tasks.Task Type Parameters Name Description TIn TOut Implements ITaskRunner System.IDisposable" - }, "index.html": { "href": "index.html", "title": "ComponentTask-Unity | ComponentTask", "keywords": "ComponentTask-Unity Unity package for running dotnet Task and Task scoped to Unity components. Description Common problem with using c# async methods in Unity is that they have no concept of a component life-time. So unlike Coroutines when you 'start' a task and then destroy the component (by loading a new scene for example) the task does not stop. Most of the time leading to UnityEngine.MissingReferenceException when you try to access members of the component after it has been destroyed on the Unity side. And as a workaround you have to write ugly ' if (!this) return; ' guards after every await. This library aims to fix that problem by allowing you to run tasks 'on' your MonoBehaviour with very similar behaviour as Unity's Coroutines . Documentation Install How To Examples Api Reference Repository CI Basic Azure pipeline for running tests: Pipeline ." }, - "how-to.html": { - "href": "how-to.html", - "title": "How To | ComponentTask", - "keywords": "How To Usage Start a 'Task' on your MonoBehaviour with this.StartTask(...) . The task then runs 'on' your MonoBehaviour meaning it gets paused when your MonoBehaviour is disabled and it gets stopped when your MonoBehaviour gets destroyed. This means that inside your task you don't need to worry about being destroyed. Any exceptions that happen inside your Task are reported to the Unity log, so no silent failures. Basic example using System.Threading.Tasks; using UnityEngine; class MyClass : MonoBehaviour { void Start() { this.StartTask(RunAsync); } async Task RunAsync() { while (true) { Debug.Log(\"Running...\"); await Task.Yield(); } } } This example will print Running... every frame when the component is enabled and will stop when the component gets destroyed." - }, - "api/ComponentTask.Exceptions.InactiveGameObjectException.html": { - "href": "api/ComponentTask.Exceptions.InactiveGameObjectException.html", - "title": "Class InactiveGameObjectException | ComponentTask", - "keywords": "Class InactiveGameObjectException Exception that is thrown when attempting to execute a operation on a inactive gameobject. Inheritance System.Object System.Exception System.SystemException System.InvalidOperationException InactiveGameObjectException Implements System.Runtime.Serialization.ISerializable System.Runtime.InteropServices._Exception Inherited Members System.Exception.GetBaseException() System.Exception.ToString() System.Exception.GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext) System.Exception.GetType() System.Exception.Message System.Exception.Data System.Exception.InnerException System.Exception.TargetSite System.Exception.StackTrace System.Exception.HelpLink System.Exception.Source System.Exception.HResult System.Exception.SerializeObjectState System.Object.Equals(System.Object) System.Object.Equals(System.Object, System.Object) System.Object.GetHashCode() System.Object.MemberwiseClone() System.Object.ReferenceEquals(System.Object, System.Object) Namespace : ComponentTask.Exceptions Assembly : cs.temp.dll.dll Syntax public sealed class InactiveGameObjectException : InvalidOperationException, ISerializable, _Exception Implements System.Runtime.Serialization.ISerializable System.Runtime.InteropServices._Exception" - }, "examples.html": { "href": "examples.html", "title": "Examples | ComponentTask", "keywords": "Examples These examples can also be found in the .example directory. Basic example using System.Threading.Tasks; using UnityEngine; class MyClass : MonoBehaviour { void Start() { this.StartTask(RunAsync); } async Task RunAsync() { while (true) { Debug.Log(\"Running...\"); await Task.Yield(); } } } This example will print Running... every frame when the component is enabled and will stop when the component gets destroyed. Awaiting other methods using System; using System.Threading.Tasks; using UnityEngine; class MyClass : MonoBehaviour { void Start() { this.StartTask(RunAsync); } async Task RunAsync() { while (true) { var val = await GetValueAsync(); Debug.Log($\"Got value: '{val}'\"); } } async Task GetValueAsync() { await Task.Delay(TimeSpan.FromSeconds(1)); return Time.frameCount; } } When you await other methods they automatically belong to the same scope as the task that starts them. So in this example GetValueAsync also runs as part of the MyClass scope and stops when the component is destroyed. Exposing a method that produces a value But what if you want to expose a api that produces a value, what happens to the task once your component gets destroyed. using System; using System.Threading.Tasks; using UnityEngine; class Producer : MonoBehaviour { public Task GetValueAsync() => this.StartTask(ProduceValueAsync); async Task ProduceValueAsync() { await Task.Delay(TimeSpan.FromSeconds(1)); return Time.frameCount; } } The Task (or Task ) returned out of This.StartTask(...) properly goes into a 'cancelled' state when the component is destroyed. Which means that when you await that task you will get a TaskCanceledException that you can handle. On the receiving side: using System.Threading.Tasks; using UnityEngine; class Consumer : MonoBehaviour { [SerializeField] private Producer producer; void Start() { this.StartTask(RunAsync); } async Task RunAsync() { try { var val = await producer.GetValueAsync(); Debug.Log($\"Got value: '{val}'\"); } catch (TaskCanceledException) { Debug.Log(\"The producer was destroyed before producing the result\"); } } } If you don't catch the exception then the exception is logged to the unity log and your task will go to a faulted state. But the nice thing is that if both components have the same lifetime (destroyed at the same time) then there is no problem (and you won't get any exceptions). Avoiding closures To avoid having to capture closures you can pass an argument into you task using this.StartTask(...) . using System; using System.Threading.Tasks; using UnityEngine; class MyClass : MonoBehaviour { void Start() { var delay = 1; this.StartTask(WaitAndDoSomethingAsync, delay); } async Task WaitAndDoSomethingAsync(int secondsDelay) { await Task.Delay(TimeSpan.FromSeconds(secondsDelay)); Debug.Log(\"Doing something\"); } } Only one argument is supported but with the 'new' tuples in c# 7 there is a nice (and efficient) workaround: using System; using System.Threading.Tasks; using UnityEngine; class MyClassWithValueTuple : MonoBehaviour { void Start() { this.StartTask(WaitAndLog, (secondsDelay: 1, message: \"Hello World\")); } async Task WaitAndLog((int secondsDelay, string message) input) { await Task.Delay(TimeSpan.FromSeconds(input.secondsDelay)); Debug.Log(input.message); } } Cancelling external work To make it easier to cancel external work when your component is destroyed this.StartTask(...) optionally gives you a CancellationToken to give to external api's. using System.Net.Http; using System.Threading; using System.Threading.Tasks; using UnityEngine; class MyClass : MonoBehaviour { void Start() { var url = \"https://github.com/BastianBlokland/componenttask-unity\"; this.StartTask(DownloadTextAsync, url); } async Task DownloadTextAsync(string url, CancellationToken cancelToken) { using (var client = new HttpClient()) { var response = await client.GetAsync(url, cancelToken); var responseText = await response.Content.ReadAsStringAsync(); Debug.Log($\"Text: '{responseText}'\"); } } } Giving the CancellationToken here will make sure that the web-request is actually aborted when this component is destroyed. Running expensive blocking work on a background thread Something that the Task based model make very easy is interacting with code that runs on a different thread. You can for example run your expensive blocking code in a background thread and await a Task handle to it. using System; using System.Threading; using System.Threading.Tasks; using UnityEngine; class MyClass : MonoBehaviour { void Start() { this.StartTask(RunAsync); } async Task RunAsync() { var result = await Task.Run(VeryExpensiveBlockingCode); Debug.Log($\"Got value: '{result}'\"); } int VeryExpensiveBlockingCode() { Thread.Sleep(TimeSpan.FromSeconds(5)); return 42; } } Even though VeryExpensiveBlockingCode blocks for 5 seconds because we run it on a background-thread (with Task.Run ) the unity-thread stays responsive. Caching a task-runner. If you are going to start many tasks you can also create a ITaskRunner on a gameobject and cache a reference to it. That runner will remain valid as long as that gameobject is still alive. using System.Threading.Tasks; using UnityEngine; using ComponentTask; class MyClass : MonoBehaviour { private ITaskRunner runner; void Start() { this.runner = this.gameObject.CreateTaskRunner(); } void Update() { this.runner.StartTask(this.WaitAndLogAsync); } async Task WaitAndLogAsync() { await Task.Yield(); Debug.Log(\"Running\"); } } Custom LocalTaskRunner. If you dont to scope you tasks to Unity Components but control the update ticks yourself you can manually create a 'LocalTaskRunner' and control its ticks yourself. using System; using System.Threading.Tasks; using UnityEngine; using ComponentTask; class MyClass : MonoBehaviour, IExceptionHandler { [SerializeField] private bool isPaused; private LocalTaskRunner runner; void Start() { this.runner = new LocalTaskRunner(exceptionHandler: this); this.runner.StartTask(this.RunAsync); } void Update() { if (!this.isPaused) this.runner.Execute(); } void OnDestroy() { this.runner.Dispose(); } async Task RunAsync() { while (true) { Debug.Log(\"Running\"); await Task.Yield(); } } void IExceptionHandler.Handle(Exception exception) { Debug.Log($\"Exception occurred: '{exception.Message}'\"); } } OnGUI tasks using custom LocalTaskRunner. Because with a custom LocalTaskRunner you control when tasks are updated you could implement tasks that run during OnGUI to draw ui. using System; using System.Threading.Tasks; using UnityEngine; using ComponentTask; class MyClass : MonoBehaviour, IExceptionHandler { private LocalTaskRunner guiTaskRunner; void Start() { this.guiTaskRunner = new LocalTaskRunner(exceptionHandler: this); this.guiTaskRunner.StartTask(this.DrawUIAsync); } void OnGUI() { this.guiTaskRunner.Execute(); } void OnDestroy() { this.guiTaskRunner.Dispose(); } async Task DrawUIAsync() { while (true) { await Task.Yield(); GUI.Label(new Rect(0f, 0f, 100f, 100f), \"Drawn from a task :)\"); } } void IExceptionHandler.Handle(Exception exception) { Debug.Log($\"Exception occurred: '{exception.Message}'\"); } } Using a similar pattern your can make tasks task run during FixedUpdate to interact with Unity's physics world for example." }, - "api/ComponentTask.Config.html": { - "href": "api/ComponentTask.Config.html", - "title": "Class Config | ComponentTask", - "keywords": "Class Config Global configuration. Inheritance System.Object Config Inherited Members System.Object.Equals(System.Object) System.Object.Equals(System.Object, System.Object) System.Object.GetHashCode() System.Object.GetType() System.Object.MemberwiseClone() System.Object.ToString() System.Object.ReferenceEquals(System.Object, System.Object) Namespace : ComponentTask Assembly : cs.temp.dll.dll Syntax public static class Config Properties GlobalDiagnosticsActive Should diagnostics be enabled. Declaration public static bool GlobalDiagnosticsActive { get; set; } Property Value Type Description System.Boolean True if diagnostics are active, otherwise false. Remarks Runs all tasks with the ' DiagnosticLogging ' flag." - }, - "api/UnityEngine.TaskRunOptions.html": { - "href": "api/UnityEngine.TaskRunOptions.html", - "title": "Enum TaskRunOptions | ComponentTask", - "keywords": "Enum TaskRunOptions Flags for configuring how tasks are being run. Namespace : UnityEngine Assembly : cs.temp.dll.dll Syntax [Flags] public enum TaskRunOptions Fields Name Description Default Default run options. DiagnosticLogging Enable diagnostic logging. UpdateWhileComponentDisabled Tasks are updated even if the component is disabled." - }, "api/ComponentTask.ITaskRunner.html": { "href": "api/ComponentTask.ITaskRunner.html", "title": "Interface ITaskRunner | ComponentTask", "keywords": "Interface ITaskRunner Runner for running tasks. Namespace : ComponentTask Assembly : cs.temp.dll.dll Syntax public interface ITaskRunner Methods StartTask(Func) Start a task on this runner. that is passed to the task-creator is cancelled when the runner is disposed, this can be usefull for cancelling external processes. Declaration Task StartTask(Func taskCreator) Parameters Type Name Description System.Func < CancellationToken , System.Threading.Tasks.Task > taskCreator Function for creating the task. Returns Type Description System.Threading.Tasks.Task Task that completes when the original task completes or when the runner gets disposed. Exceptions Type Condition TaskCreatorReturnedNullException Thrown when null is returned from the 'taskCreator'. ComponentTaskCanceledException Thrown when awaiting a component-task that gets cancelled. Can happen if you are awaiting a component that gets destroyed. StartTask(Func) Start a task on this runner. Declaration Task StartTask(Func taskCreator) Parameters Type Name Description System.Func < System.Threading.Tasks.Task > taskCreator Function for creating the task. Returns Type Description System.Threading.Tasks.Task Task that completes when the original task completes or when the runner gets disposed. Exceptions Type Condition TaskCreatorReturnedNullException Thrown when null is returned from the 'taskCreator'. ComponentTaskCanceledException Thrown when awaiting a component-task that gets cancelled. StartTask(Func, TIn) Start a task on this runner. that is passed to the task-creator is cancelled when the runner is disposed, this can be usefull for cancelling external processes. Declaration Task StartTask(Func taskCreator, TIn data) Parameters Type Name Description System.Func taskCreator Function for creating the task. TIn data Data to pass into the taskCreator . Returns Type Description System.Threading.Tasks.Task Task that completes when the original task completes or when the runner gets disposed. Type Parameters Name Description TIn Type of the data to pass into the taskCreator . Exceptions Type Condition TaskCreatorReturnedNullException Thrown when null is returned from the 'taskCreator'. ComponentTaskCanceledException Thrown when awaiting a component-task that gets cancelled. Can happen if you are awaiting a component that gets destroyed. StartTask(Func, TIn) Start a task on this runner. Declaration Task StartTask(Func taskCreator, TIn data) Parameters Type Name Description System.Func taskCreator Function for creating the task. TIn data Data to pass into the taskCreator . Returns Type Description System.Threading.Tasks.Task Task that completes when the original task completes or when the runner gets disposed. Type Parameters Name Description TIn Type of the data to pass into the taskCreator . Exceptions Type Condition TaskCreatorReturnedNullException Thrown when null is returned from the 'taskCreator'. ComponentTaskCanceledException Thrown when awaiting a component-task that gets cancelled. StartTask(Func>) Start a task on this runner. that is passed to the task-creator is cancelled when the runner is disposed, this can be usefull for cancelling external processes. Declaration Task StartTask(Func> taskCreator) Parameters Type Name Description System.Func < CancellationToken , System.Threading.Tasks.Task > taskCreator Function for creating the task. Returns Type Description System.Threading.Tasks.Task Task that completes when the original task completes or when the runner gets disposed. Type Parameters Name Description TOut Exceptions Type Condition TaskCreatorReturnedNullException Thrown when null is returned from the 'taskCreator'. ComponentTaskCanceledException Thrown when awaiting a component-task that gets cancelled. Can happen if you are awaiting a component that gets destroyed. StartTask(Func>) Start a task on this runner. Declaration Task StartTask(Func> taskCreator) Parameters Type Name Description System.Func < System.Threading.Tasks.Task > taskCreator Function for creating the task. Returns Type Description System.Threading.Tasks.Task Task that completes when the original task completes or when the runner gets disposed. Type Parameters Name Description TOut Exceptions Type Condition TaskCreatorReturnedNullException Thrown when null is returned from the 'taskCreator'. ComponentTaskCanceledException Thrown when awaiting a component-task that gets cancelled. StartTask(Func>, TIn) Start a task on this runner. that is passed to the task-creator is cancelled when the runner is disposed, this can be usefull for cancelling external processes. Declaration Task StartTask(Func> taskCreator, TIn data) Parameters Type Name Description System.Func > taskCreator Function for creating the task. TIn data Returns Type Description System.Threading.Tasks.Task Task that completes when the original task completes or when the runner gets disposed. Type Parameters Name Description TIn TOut Exceptions Type Condition TaskCreatorReturnedNullException Thrown when null is returned from the 'taskCreator'. ComponentTaskCanceledException Thrown when awaiting a component-task that gets cancelled. Can happen if you are awaiting a component that gets destroyed. StartTask(Func>, TIn) Start a task on this runner. Declaration Task StartTask(Func> taskCreator, TIn data) Parameters Type Name Description System.Func > taskCreator Function for creating the task. TIn data Data to pass into the taskCreator . Returns Type Description System.Threading.Tasks.Task Task that completes when the original task completes or when the runner gets disposed. Type Parameters Name Description TIn Type of the data to pass into the taskCreator . TOut Exceptions Type Condition TaskCreatorReturnedNullException Thrown when null is returned from the 'taskCreator'. ComponentTaskCanceledException Thrown when awaiting a component-task that gets cancelled." }, - "api/ComponentTask.IDiagnosticLogger.html": { - "href": "api/ComponentTask.IDiagnosticLogger.html", - "title": "Interface IDiagnosticLogger | ComponentTask", - "keywords": "Interface IDiagnosticLogger Interface for logging diagnostic output. Namespace : ComponentTask Assembly : cs.temp.dll.dll Syntax public interface IDiagnosticLogger Remarks Can be used to get diagnostic output when using a custom LocalTaskRunner . Methods Log(String) Log a diagnostic message. Declaration void Log(string message) Parameters Type Name Description System.String message Message to log." - }, - "api/ComponentTask.Exceptions.InactiveComponentException.html": { - "href": "api/ComponentTask.Exceptions.InactiveComponentException.html", - "title": "Class InactiveComponentException | ComponentTask", - "keywords": "Class InactiveComponentException Exception that is thrown when attempting to execute a operation on a inactive component. Inheritance System.Object System.Exception System.SystemException System.InvalidOperationException InactiveComponentException Implements System.Runtime.Serialization.ISerializable System.Runtime.InteropServices._Exception Inherited Members System.Exception.GetBaseException() System.Exception.ToString() System.Exception.GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext) System.Exception.GetType() System.Exception.Message System.Exception.Data System.Exception.InnerException System.Exception.TargetSite System.Exception.StackTrace System.Exception.HelpLink System.Exception.Source System.Exception.HResult System.Exception.SerializeObjectState System.Object.Equals(System.Object) System.Object.Equals(System.Object, System.Object) System.Object.GetHashCode() System.Object.MemberwiseClone() System.Object.ReferenceEquals(System.Object, System.Object) Namespace : ComponentTask.Exceptions Assembly : cs.temp.dll.dll Syntax public sealed class InactiveComponentException : InvalidOperationException, ISerializable, _Exception Implements System.Runtime.Serialization.ISerializable System.Runtime.InteropServices._Exception" + "how-to.html": { + "href": "how-to.html", + "title": "How To | ComponentTask", + "keywords": "How To Usage Start a 'Task' on your MonoBehaviour with this.StartTask(...) . The task then runs 'on' your MonoBehaviour meaning it gets paused when your MonoBehaviour is disabled and it gets stopped when your MonoBehaviour gets destroyed. This means that inside your task you don't need to worry about being destroyed. Any exceptions that happen inside your Task are reported to the Unity log, so no silent failures. Basic example using System.Threading.Tasks; using UnityEngine; class MyClass : MonoBehaviour { void Start() { this.StartTask(RunAsync); } async Task RunAsync() { while (true) { Debug.Log(\"Running...\"); await Task.Yield(); } } } This example will print Running... every frame when the component is enabled and will stop when the component gets destroyed." }, - "api/ComponentTask.Exceptions.TaskCreatorReturnedNullException.html": { - "href": "api/ComponentTask.Exceptions.TaskCreatorReturnedNullException.html", - "title": "Class TaskCreatorReturnedNullException | ComponentTask", - "keywords": "Class TaskCreatorReturnedNullException Exception that is thrown when a task-creator returns null. Inheritance System.Object System.Exception System.SystemException System.InvalidOperationException TaskCreatorReturnedNullException Implements System.Runtime.Serialization.ISerializable System.Runtime.InteropServices._Exception Inherited Members System.Exception.GetBaseException() System.Exception.ToString() System.Exception.GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext) System.Exception.GetType() System.Exception.Message System.Exception.Data System.Exception.InnerException System.Exception.TargetSite System.Exception.StackTrace System.Exception.HelpLink System.Exception.Source System.Exception.HResult System.Exception.SerializeObjectState System.Object.Equals(System.Object) System.Object.Equals(System.Object, System.Object) System.Object.GetHashCode() System.Object.MemberwiseClone() System.Object.ReferenceEquals(System.Object, System.Object) Namespace : ComponentTask.Exceptions Assembly : cs.temp.dll.dll Syntax public sealed class TaskCreatorReturnedNullException : InvalidOperationException, ISerializable, _Exception Implements System.Runtime.Serialization.ISerializable System.Runtime.InteropServices._Exception" + "install.html": { + "href": "install.html", + "title": "Installation | ComponentTask", + "keywords": "Installation Add package Add a reference to this repository to your package dependencies ( Packages/manifest.json ) \"dependencies\": { \"com.bastianblokland.componenttask\": \"https://github.com/BastianBlokland/componenttask-unity.git#v1.8\", ... } Use the tag at the end to specify the version to use. Latest version: Avoid adding a git path without a tag as latest master is not guaranteed to be stable, also it will make package resolving non-deterministic as every time you resolve master it might be a different commit. Upgrading To update to a newer version simply open your package manifest ( Packages/manifest.json ) and set the tag at the end of the git url (for example v1.8.2 ) to a later version." }, "api/UnityEngine.html": { "href": "api/UnityEngine.html", "title": "Namespace UnityEngine | ComponentTask", "keywords": "Namespace UnityEngine Classes ComponentExtensions Extensions for 'UnityEngine.Component'. GameObjectExtensions Extensions for 'UnityEngine.GameObject'. TaskExtensions Extensions for 'System.Task'. Enums TaskRunOptions Flags for configuring how tasks are being run." }, + "api/UnityEngine.TaskRunOptions.html": { + "href": "api/UnityEngine.TaskRunOptions.html", + "title": "Enum TaskRunOptions | ComponentTask", + "keywords": "Enum TaskRunOptions Flags for configuring how tasks are being run. Namespace : UnityEngine Assembly : cs.temp.dll.dll Syntax [Flags] public enum TaskRunOptions Fields Name Description Default Default run options. DiagnosticLogging Enable diagnostic logging. UpdateWhileComponentDisabled Tasks are updated even if the component is disabled." + }, + "api/ComponentTask.html": { + "href": "api/ComponentTask.html", + "title": "Namespace ComponentTask | ComponentTask", + "keywords": "Namespace ComponentTask Classes Config Global configuration. LocalTaskRunner TaskRunner that you can 'tick' manually. Interfaces IDiagnosticLogger Interface for logging diagnostic output. IExceptionHandler Interface for a exception handler. ITaskRunner Runner for running tasks." + }, "api/ComponentTask.IExceptionHandler.html": { "href": "api/ComponentTask.IExceptionHandler.html", "title": "Interface IExceptionHandler | ComponentTask", "keywords": "Interface IExceptionHandler Interface for a exception handler. Namespace : ComponentTask Assembly : cs.temp.dll.dll Syntax public interface IExceptionHandler Remarks Can be used to log exceptions when using a custom LocalTaskRunner . Methods Handle(Exception) Handle the exception that was thrown. Declaration void Handle(Exception exception) Parameters Type Name Description System.Exception exception Exception that was thrown." }, + "api/ComponentTask.Exceptions.html": { + "href": "api/ComponentTask.Exceptions.html", + "title": "Namespace ComponentTask.Exceptions | ComponentTask", + "keywords": "Namespace ComponentTask.Exceptions Classes ComponentTaskCanceledException Exception that is attached to tasks returned from ITaskRunner when they are cancelled. ContextChangedException Exception that is thrown when the 'SynchronizationContext.Current' changes unexpectedly, most likely caused by code that sets 'SynchronizationContext.Current' but does not set it back to the previous. InactiveComponentException Exception that is thrown when attempting to execute a operation on a inactive component. InactiveGameObjectException Exception that is thrown when attempting to execute a operation on a inactive gameobject. NonUnityThreadException Exception that is thrown when an api that can only be called from the unity-thread is called from a different thread. NotPlayingException Exception that is thrown when an api that can only be called while 'Playing' is called in edit-mode. TaskCreatorReturnedNullException Exception that is thrown when a task-creator returns null." + }, + "api/index.html": { + "href": "api/index.html", + "title": "Api Reference | ComponentTask", + "keywords": "Api Reference Main api lives in the ' ComponentTask ' namespace. And some extension methods live in the UnityEngine namespace. Reason for having those extension methods live in the UnityEngine namespace is that it avoids users having to add using directives and also makes the api more discoverable as it will show up in intellisense. To avoid cluttering the UnityEngine namespace as few as possibles types live there. Namespaces ComponentTask UnityEngine Source All source is available on Github ." + }, + "api/ComponentTask.Exceptions.InactiveComponentException.html": { + "href": "api/ComponentTask.Exceptions.InactiveComponentException.html", + "title": "Class InactiveComponentException | ComponentTask", + "keywords": "Class InactiveComponentException Exception that is thrown when attempting to execute a operation on a inactive component. Inheritance System.Object System.Exception System.SystemException System.InvalidOperationException InactiveComponentException Implements System.Runtime.Serialization.ISerializable System.Runtime.InteropServices._Exception Inherited Members System.Exception.GetBaseException() System.Exception.ToString() System.Exception.GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext) System.Exception.GetType() System.Exception.Message System.Exception.Data System.Exception.InnerException System.Exception.TargetSite System.Exception.StackTrace System.Exception.HelpLink System.Exception.Source System.Exception.HResult System.Exception.SerializeObjectState System.Object.Equals(System.Object) System.Object.Equals(System.Object, System.Object) System.Object.GetHashCode() System.Object.MemberwiseClone() System.Object.ReferenceEquals(System.Object, System.Object) Namespace : ComponentTask.Exceptions Assembly : cs.temp.dll.dll Syntax public sealed class InactiveComponentException : InvalidOperationException, ISerializable, _Exception Implements System.Runtime.Serialization.ISerializable System.Runtime.InteropServices._Exception" + }, + "api/ComponentTask.Exceptions.NotPlayingException.html": { + "href": "api/ComponentTask.Exceptions.NotPlayingException.html", + "title": "Class NotPlayingException | ComponentTask", + "keywords": "Class NotPlayingException Exception that is thrown when an api that can only be called while 'Playing' is called in edit-mode. Inheritance System.Object System.Exception System.SystemException System.InvalidOperationException NotPlayingException Implements System.Runtime.Serialization.ISerializable System.Runtime.InteropServices._Exception Inherited Members System.Exception.GetBaseException() System.Exception.ToString() System.Exception.GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext) System.Exception.GetType() System.Exception.Message System.Exception.Data System.Exception.InnerException System.Exception.TargetSite System.Exception.StackTrace System.Exception.HelpLink System.Exception.Source System.Exception.HResult System.Exception.SerializeObjectState System.Object.Equals(System.Object) System.Object.Equals(System.Object, System.Object) System.Object.GetHashCode() System.Object.MemberwiseClone() System.Object.ReferenceEquals(System.Object, System.Object) Namespace : ComponentTask.Exceptions Assembly : cs.temp.dll.dll Syntax public sealed class NotPlayingException : InvalidOperationException, ISerializable, _Exception Implements System.Runtime.Serialization.ISerializable System.Runtime.InteropServices._Exception" + }, + "api/ComponentTask.Config.html": { + "href": "api/ComponentTask.Config.html", + "title": "Class Config | ComponentTask", + "keywords": "Class Config Global configuration. Inheritance System.Object Config Inherited Members System.Object.Equals(System.Object) System.Object.Equals(System.Object, System.Object) System.Object.GetHashCode() System.Object.GetType() System.Object.MemberwiseClone() System.Object.ToString() System.Object.ReferenceEquals(System.Object, System.Object) Namespace : ComponentTask Assembly : cs.temp.dll.dll Syntax public static class Config Properties GlobalDiagnosticsActive Should diagnostics be enabled. Declaration public static bool GlobalDiagnosticsActive { get; set; } Property Value Type Description System.Boolean True if diagnostics are active, otherwise false. Remarks Runs all tasks with the ' DiagnosticLogging ' flag." + }, + "api/ComponentTask.Exceptions.ContextChangedException.html": { + "href": "api/ComponentTask.Exceptions.ContextChangedException.html", + "title": "Class ContextChangedException | ComponentTask", + "keywords": "Class ContextChangedException Exception that is thrown when the 'SynchronizationContext.Current' changes unexpectedly, most likely caused by code that sets 'SynchronizationContext.Current' but does not set it back to the previous. Inheritance System.Object System.Exception System.SystemException System.InvalidOperationException ContextChangedException Implements System.Runtime.Serialization.ISerializable System.Runtime.InteropServices._Exception Inherited Members System.Exception.GetBaseException() System.Exception.ToString() System.Exception.GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext) System.Exception.GetType() System.Exception.Message System.Exception.Data System.Exception.InnerException System.Exception.TargetSite System.Exception.StackTrace System.Exception.HelpLink System.Exception.Source System.Exception.HResult System.Exception.SerializeObjectState System.Object.Equals(System.Object) System.Object.Equals(System.Object, System.Object) System.Object.GetHashCode() System.Object.MemberwiseClone() System.Object.ReferenceEquals(System.Object, System.Object) Namespace : ComponentTask.Exceptions Assembly : cs.temp.dll.dll Syntax public sealed class ContextChangedException : InvalidOperationException, ISerializable, _Exception Implements System.Runtime.Serialization.ISerializable System.Runtime.InteropServices._Exception" + }, + "api/ComponentTask.Exceptions.InactiveGameObjectException.html": { + "href": "api/ComponentTask.Exceptions.InactiveGameObjectException.html", + "title": "Class InactiveGameObjectException | ComponentTask", + "keywords": "Class InactiveGameObjectException Exception that is thrown when attempting to execute a operation on a inactive gameobject. Inheritance System.Object System.Exception System.SystemException System.InvalidOperationException InactiveGameObjectException Implements System.Runtime.Serialization.ISerializable System.Runtime.InteropServices._Exception Inherited Members System.Exception.GetBaseException() System.Exception.ToString() System.Exception.GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext) System.Exception.GetType() System.Exception.Message System.Exception.Data System.Exception.InnerException System.Exception.TargetSite System.Exception.StackTrace System.Exception.HelpLink System.Exception.Source System.Exception.HResult System.Exception.SerializeObjectState System.Object.Equals(System.Object) System.Object.Equals(System.Object, System.Object) System.Object.GetHashCode() System.Object.MemberwiseClone() System.Object.ReferenceEquals(System.Object, System.Object) Namespace : ComponentTask.Exceptions Assembly : cs.temp.dll.dll Syntax public sealed class InactiveGameObjectException : InvalidOperationException, ISerializable, _Exception Implements System.Runtime.Serialization.ISerializable System.Runtime.InteropServices._Exception" + }, "api/ComponentTask.Exceptions.ComponentTaskCanceledException.html": { "href": "api/ComponentTask.Exceptions.ComponentTaskCanceledException.html", "title": "Class ComponentTaskCanceledException | ComponentTask", @@ -89,34 +89,34 @@ "title": "Class GameObjectExtensions | ComponentTask", "keywords": "Class GameObjectExtensions Extensions for 'UnityEngine.GameObject'. Inheritance System.Object GameObjectExtensions Inherited Members System.Object.Equals(System.Object) System.Object.Equals(System.Object, System.Object) System.Object.GetHashCode() System.Object.GetType() System.Object.MemberwiseClone() System.Object.ToString() System.Object.ReferenceEquals(System.Object, System.Object) Namespace : UnityEngine Assembly : cs.temp.dll.dll Syntax public static class GameObjectExtensions Methods CreateTaskRunner(GameObject, TaskRunOptions) Create a on the given gameobject. Declaration public static ITaskRunner CreateTaskRunner(this GameObject gameObject, TaskRunOptions options = TaskRunOptions.Default) Parameters Type Name Description GameObject gameObject GameObject to create the task-runner on. TaskRunOptions options Options for configuring how tasks are run on this runner. Returns Type Description ITaskRunner Newly created . Remarks If you run tasks on the returned runner then they are cancelled automatically when the gameobject is destroyed. Can only be called from the unity-thread in play-mode. Exceptions Type Condition NotPlayingException Thrown when called in edit-mode. NonUnityThreadException Thrown when called from a non-unity thread." }, - "api/ComponentTask.html": { - "href": "api/ComponentTask.html", - "title": "Namespace ComponentTask | ComponentTask", - "keywords": "Namespace ComponentTask Classes Config Global configuration. LocalTaskRunner TaskRunner that you can 'tick' manually. Interfaces IDiagnosticLogger Interface for logging diagnostic output. IExceptionHandler Interface for a exception handler. ITaskRunner Runner for running tasks." + "api/ComponentTask.Exceptions.NonUnityThreadException.html": { + "href": "api/ComponentTask.Exceptions.NonUnityThreadException.html", + "title": "Class NonUnityThreadException | ComponentTask", + "keywords": "Class NonUnityThreadException Exception that is thrown when an api that can only be called from the unity-thread is called from a different thread. Inheritance System.Object System.Exception System.SystemException System.InvalidOperationException NonUnityThreadException Implements System.Runtime.Serialization.ISerializable System.Runtime.InteropServices._Exception Inherited Members System.Exception.GetBaseException() System.Exception.ToString() System.Exception.GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext) System.Exception.GetType() System.Exception.Message System.Exception.Data System.Exception.InnerException System.Exception.TargetSite System.Exception.StackTrace System.Exception.HelpLink System.Exception.Source System.Exception.HResult System.Exception.SerializeObjectState System.Object.Equals(System.Object) System.Object.Equals(System.Object, System.Object) System.Object.GetHashCode() System.Object.MemberwiseClone() System.Object.ReferenceEquals(System.Object, System.Object) Namespace : ComponentTask.Exceptions Assembly : cs.temp.dll.dll Syntax public sealed class NonUnityThreadException : InvalidOperationException, ISerializable, _Exception Implements System.Runtime.Serialization.ISerializable System.Runtime.InteropServices._Exception" }, "api/UnityEngine.TaskExtensions.html": { "href": "api/UnityEngine.TaskExtensions.html", "title": "Class TaskExtensions | ComponentTask", "keywords": "Class TaskExtensions Extensions for 'System.Task'. Inheritance System.Object TaskExtensions Inherited Members System.Object.Equals(System.Object) System.Object.Equals(System.Object, System.Object) System.Object.GetHashCode() System.Object.GetType() System.Object.MemberwiseClone() System.Object.ToString() System.Object.ReferenceEquals(System.Object, System.Object) Namespace : UnityEngine Assembly : cs.temp.dll.dll Syntax public static class TaskExtensions Methods DontWait(Task) Extension method to suppress the warning you get when you don't await a task in a async method. Declaration public static void DontWait(this Task task) Parameters Type Name Description System.Threading.Tasks.Task task Task to not wait for. Remarks Should only be used when you are sure that not-waiting for the task is what you want." }, - "api/ComponentTask.Exceptions.ContextChangedException.html": { - "href": "api/ComponentTask.Exceptions.ContextChangedException.html", - "title": "Class ContextChangedException | ComponentTask", - "keywords": "Class ContextChangedException Exception that is thrown when the 'SynchronizationContext.Current' changes unexpectedly, most likely caused by code that sets 'SynchronizationContext.Current' but does not set it back to the previous. Inheritance System.Object System.Exception System.SystemException System.InvalidOperationException ContextChangedException Implements System.Runtime.Serialization.ISerializable System.Runtime.InteropServices._Exception Inherited Members System.Exception.GetBaseException() System.Exception.ToString() System.Exception.GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext) System.Exception.GetType() System.Exception.Message System.Exception.Data System.Exception.InnerException System.Exception.TargetSite System.Exception.StackTrace System.Exception.HelpLink System.Exception.Source System.Exception.HResult System.Exception.SerializeObjectState System.Object.Equals(System.Object) System.Object.Equals(System.Object, System.Object) System.Object.GetHashCode() System.Object.MemberwiseClone() System.Object.ReferenceEquals(System.Object, System.Object) Namespace : ComponentTask.Exceptions Assembly : cs.temp.dll.dll Syntax public sealed class ContextChangedException : InvalidOperationException, ISerializable, _Exception Implements System.Runtime.Serialization.ISerializable System.Runtime.InteropServices._Exception" - }, - "api/ComponentTask.Exceptions.html": { - "href": "api/ComponentTask.Exceptions.html", - "title": "Namespace ComponentTask.Exceptions | ComponentTask", - "keywords": "Namespace ComponentTask.Exceptions Classes ComponentTaskCanceledException Exception that is attached to tasks returned from ITaskRunner when they are cancelled. ContextChangedException Exception that is thrown when the 'SynchronizationContext.Current' changes unexpectedly, most likely caused by code that sets 'SynchronizationContext.Current' but does not set it back to the previous. InactiveComponentException Exception that is thrown when attempting to execute a operation on a inactive component. InactiveGameObjectException Exception that is thrown when attempting to execute a operation on a inactive gameobject. NonUnityThreadException Exception that is thrown when an api that can only be called from the unity-thread is called from a different thread. NotPlayingException Exception that is thrown when an api that can only be called while 'Playing' is called in edit-mode. TaskCreatorReturnedNullException Exception that is thrown when a task-creator returns null." + "api/ComponentTask.Exceptions.TaskCreatorReturnedNullException.html": { + "href": "api/ComponentTask.Exceptions.TaskCreatorReturnedNullException.html", + "title": "Class TaskCreatorReturnedNullException | ComponentTask", + "keywords": "Class TaskCreatorReturnedNullException Exception that is thrown when a task-creator returns null. Inheritance System.Object System.Exception System.SystemException System.InvalidOperationException TaskCreatorReturnedNullException Implements System.Runtime.Serialization.ISerializable System.Runtime.InteropServices._Exception Inherited Members System.Exception.GetBaseException() System.Exception.ToString() System.Exception.GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext) System.Exception.GetType() System.Exception.Message System.Exception.Data System.Exception.InnerException System.Exception.TargetSite System.Exception.StackTrace System.Exception.HelpLink System.Exception.Source System.Exception.HResult System.Exception.SerializeObjectState System.Object.Equals(System.Object) System.Object.Equals(System.Object, System.Object) System.Object.GetHashCode() System.Object.MemberwiseClone() System.Object.ReferenceEquals(System.Object, System.Object) Namespace : ComponentTask.Exceptions Assembly : cs.temp.dll.dll Syntax public sealed class TaskCreatorReturnedNullException : InvalidOperationException, ISerializable, _Exception Implements System.Runtime.Serialization.ISerializable System.Runtime.InteropServices._Exception" }, - "api/ComponentTask.Exceptions.NonUnityThreadException.html": { - "href": "api/ComponentTask.Exceptions.NonUnityThreadException.html", - "title": "Class NonUnityThreadException | ComponentTask", - "keywords": "Class NonUnityThreadException Exception that is thrown when an api that can only be called from the unity-thread is called from a different thread. Inheritance System.Object System.Exception System.SystemException System.InvalidOperationException NonUnityThreadException Implements System.Runtime.Serialization.ISerializable System.Runtime.InteropServices._Exception Inherited Members System.Exception.GetBaseException() System.Exception.ToString() System.Exception.GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext) System.Exception.GetType() System.Exception.Message System.Exception.Data System.Exception.InnerException System.Exception.TargetSite System.Exception.StackTrace System.Exception.HelpLink System.Exception.Source System.Exception.HResult System.Exception.SerializeObjectState System.Object.Equals(System.Object) System.Object.Equals(System.Object, System.Object) System.Object.GetHashCode() System.Object.MemberwiseClone() System.Object.ReferenceEquals(System.Object, System.Object) Namespace : ComponentTask.Exceptions Assembly : cs.temp.dll.dll Syntax public sealed class NonUnityThreadException : InvalidOperationException, ISerializable, _Exception Implements System.Runtime.Serialization.ISerializable System.Runtime.InteropServices._Exception" + "api/ComponentTask.IDiagnosticLogger.html": { + "href": "api/ComponentTask.IDiagnosticLogger.html", + "title": "Interface IDiagnosticLogger | ComponentTask", + "keywords": "Interface IDiagnosticLogger Interface for logging diagnostic output. Namespace : ComponentTask Assembly : cs.temp.dll.dll Syntax public interface IDiagnosticLogger Remarks Can be used to get diagnostic output when using a custom LocalTaskRunner . Methods Log(String) Log a diagnostic message. Declaration void Log(string message) Parameters Type Name Description System.String message Message to log." }, "api/UnityEngine.ComponentExtensions.html": { "href": "api/UnityEngine.ComponentExtensions.html", "title": "Class ComponentExtensions | ComponentTask", "keywords": "Class ComponentExtensions Extensions for 'UnityEngine.Component'. Inheritance System.Object ComponentExtensions Inherited Members System.Object.Equals(System.Object) System.Object.Equals(System.Object, System.Object) System.Object.GetHashCode() System.Object.GetType() System.Object.MemberwiseClone() System.Object.ToString() System.Object.ReferenceEquals(System.Object, System.Object) Namespace : UnityEngine Assembly : cs.temp.dll.dll Syntax public static class ComponentExtensions Methods GetTaskRunner(Component, TaskRunOptions) Get a for the given component. Declaration public static ITaskRunner GetTaskRunner(this Component component, TaskRunOptions options = TaskRunOptions.Default) Parameters Type Name Description Component component Component to get the runner for. TaskRunOptions options Options for configuring how tasks are run on this runner. Returns Type Description ITaskRunner scoped to the given component. Remarks If a existing runner exists for the component then that is returned, otherwise a new runner is created. Can only be called from the unity-thread in play-mode. Exceptions Type Condition NotPlayingException Thrown when called in edit-mode. NonUnityThreadException Thrown when called from a non-unity thread. StartTask(Component, Func, TaskRunOptions) Start a task scoped to the given component. that is passed to the task-creator is cancelled when the component gets destroyed, this can be usefull for cancelling external processes. Declaration public static Task StartTask(this Component component, Func taskCreator, TaskRunOptions options = TaskRunOptions.Default) Parameters Type Name Description Component component Component to run the task 'on'. System.Func < CancellationToken , System.Threading.Tasks.Task > taskCreator Function for creating the task. TaskRunOptions options Options for configuring how the task is run. Returns Type Description System.Threading.Tasks.Task Task that completes when the original task completes or when the component gets destroyed. Remarks The task will run 'on' the component, meaning that the task gets paused when the component is disabled and the task will get cancelled when the component is destroyed. Can only be called from the unity-thread in play-mode. Exceptions Type Condition NotPlayingException Thrown when called in edit-mode. NonUnityThreadException Thrown when called from a non-unity thread. TaskCreatorReturnedNullException Thrown when null is returned from the 'taskCreator'. ComponentTaskCanceledException Thrown when awaiting a component-task that gets cancelled. Can happen if you are awaiting a component that gets destroyed. InactiveGameObjectException Thrown when attempting to start a task on a disabled gameobject. InactiveComponentException Thrown when attempting to start a task on a disabled component. Does not happen when giving UpdateWhileComponentDisabled flag. StartTask(Component, Func, TaskRunOptions) Start a task scoped to the given component. Declaration public static Task StartTask(this Component component, Func taskCreator, TaskRunOptions options = TaskRunOptions.Default) Parameters Type Name Description Component component Component to run the task 'on'. System.Func < System.Threading.Tasks.Task > taskCreator Function for creating the task. TaskRunOptions options Options for configuring how the task is run. Returns Type Description System.Threading.Tasks.Task Task that completes when the original task completes or when the component gets destroyed. Remarks The task will run 'on' the component, meaning that the task gets paused when the component is disabled and the task will get cancelled when the component is destroyed. Can only be called from the unity-thread in play-mode. Exceptions Type Condition NotPlayingException Thrown when called in edit-mode. NonUnityThreadException Thrown when called from a non-unity thread. TaskCreatorReturnedNullException Thrown when null is returned from the 'taskCreator'. ComponentTaskCanceledException Thrown when awaiting a component-task that gets cancelled. Can happen if you are awaiting a component that gets destroyed. InactiveGameObjectException Thrown when attempting to start a task on a disabled gameobject. InactiveComponentException Thrown when attempting to start a task on a disabled component. Does not happen when giving UpdateWhileComponentDisabled flag. StartTask(Component, Func, TIn, TaskRunOptions) Start a task scoped to the given component. that is passed to the task-creator is cancelled when the component gets destroyed, this can be usefull for cancelling external processes. Declaration public static Task StartTask(this Component component, Func taskCreator, TIn data, TaskRunOptions options = TaskRunOptions.Default) Parameters Type Name Description Component component Component to run the task 'on'. System.Func taskCreator Function for creating the task. TIn data TaskRunOptions options Options for configuring how the task is run. Returns Type Description System.Threading.Tasks.Task Task that completes when the original task completes or when the component gets destroyed. Type Parameters Name Description TIn Remarks The task will run 'on' the component, meaning that the task gets paused when the component is disabled and the task will get cancelled when the component is destroyed. Can only be called from the unity-thread in play-mode. Exceptions Type Condition NotPlayingException Thrown when called in edit-mode. NonUnityThreadException Thrown when called from a non-unity thread. TaskCreatorReturnedNullException Thrown when null is returned from the 'taskCreator'. ComponentTaskCanceledException Thrown when awaiting a component-task that gets cancelled. Can happen if you are awaiting a component that gets destroyed. InactiveGameObjectException Thrown when attempting to start a task on a disabled gameobject. InactiveComponentException Thrown when attempting to start a task on a disabled component. Does not happen when giving UpdateWhileComponentDisabled flag. StartTask(Component, Func, TIn, TaskRunOptions) Start a task scoped to the given component. Declaration public static Task StartTask(this Component component, Func taskCreator, TIn data, TaskRunOptions options = TaskRunOptions.Default) Parameters Type Name Description Component component Component to run the task 'on'. System.Func taskCreator Function for creating the task. TIn data TaskRunOptions options Options for configuring how the task is run. Returns Type Description System.Threading.Tasks.Task Task that completes when the original task completes or when the component gets destroyed. Type Parameters Name Description TIn Remarks The task will run 'on' the component, meaning that the task gets paused when the component is disabled and the task will get cancelled when the component is destroyed. Can only be called from the unity-thread in play-mode. Exceptions Type Condition NotPlayingException Thrown when called in edit-mode. NonUnityThreadException Thrown when called from a non-unity thread. TaskCreatorReturnedNullException Thrown when null is returned from the 'taskCreator'. ComponentTaskCanceledException Thrown when awaiting a component-task that gets cancelled. Can happen if you are awaiting a component that gets destroyed. InactiveGameObjectException Thrown when attempting to start a task on a disabled gameobject. InactiveComponentException Thrown when attempting to start a task on a disabled component. Does not happen when giving UpdateWhileComponentDisabled flag. StartTask(Component, Func>, TaskRunOptions) Start a task scoped to the given component. that is passed to the task-creator is cancelled when the component gets destroyed, this can be usefull for cancelling external processes. Declaration public static Task StartTask(this Component component, Func> taskCreator, TaskRunOptions options = TaskRunOptions.Default) Parameters Type Name Description Component component Component to run the task 'on'. System.Func < CancellationToken , System.Threading.Tasks.Task > taskCreator Function for creating the task. TaskRunOptions options Options for configuring how the task is run. Returns Type Description System.Threading.Tasks.Task Task that completes when the original task completes or when the component gets destroyed. Type Parameters Name Description TOut Remarks The task will run 'on' the component, meaning that the task gets paused when the component is disabled and the task will get cancelled when the component is destroyed. Can only be called from the unity-thread in play-mode. Exceptions Type Condition NotPlayingException Thrown when called in edit-mode. NonUnityThreadException Thrown when called from a non-unity thread. TaskCreatorReturnedNullException Thrown when null is returned from the 'taskCreator'. ComponentTaskCanceledException Thrown when awaiting a component-task that gets cancelled. Can happen if you are awaiting a component that gets destroyed. InactiveGameObjectException Thrown when attempting to start a task on a disabled gameobject. InactiveComponentException Thrown when attempting to start a task on a disabled component. Does not happen when giving UpdateWhileComponentDisabled flag. StartTask(Component, Func>, TaskRunOptions) Start a task scoped to the given component. Declaration public static Task StartTask(this Component component, Func> taskCreator, TaskRunOptions options = TaskRunOptions.Default) Parameters Type Name Description Component component Component to run the task 'on'. System.Func < System.Threading.Tasks.Task > taskCreator Function for creating the task. TaskRunOptions options Options for configuring how the task is run. Returns Type Description System.Threading.Tasks.Task Task that completes when the original task completes or when the component gets destroyed. Type Parameters Name Description TOut Remarks The task will run 'on' the component, meaning that the task gets paused when the component is disabled and the task will get cancelled when the component is destroyed. Can only be called from the unity-thread in play-mode. Exceptions Type Condition NotPlayingException Thrown when called in edit-mode. NonUnityThreadException Thrown when called from a non-unity thread. TaskCreatorReturnedNullException Thrown when null is returned from the 'taskCreator'. ComponentTaskCanceledException Thrown when awaiting a component-task that gets cancelled. Can happen if you are awaiting a component that gets destroyed. InactiveGameObjectException Thrown when attempting to start a task on a disabled gameobject. InactiveComponentException Thrown when attempting to start a task on a disabled component. Does not happen when giving UpdateWhileComponentDisabled flag. StartTask(Component, Func>, TIn, TaskRunOptions) Start a task scoped to the given component. that is passed to the task-creator is cancelled when the component gets destroyed, this can be usefull for cancelling external processes. Declaration public static Task StartTask(this Component component, Func> taskCreator, TIn data, TaskRunOptions options = TaskRunOptions.Default) Parameters Type Name Description Component component Component to run the task 'on'. System.Func > taskCreator Function for creating the task. TIn data TaskRunOptions options Options for configuring how the task is run. Returns Type Description System.Threading.Tasks.Task Task that completes when the original task completes or when the component gets destroyed. Type Parameters Name Description TIn TOut Remarks The task will run 'on' the component, meaning that the task gets paused when the component is disabled and the task will get cancelled when the component is destroyed. Can only be called from the unity-thread in play-mode. Exceptions Type Condition NotPlayingException Thrown when called in edit-mode. NonUnityThreadException Thrown when called from a non-unity thread. TaskCreatorReturnedNullException Thrown when null is returned from the 'taskCreator'. ComponentTaskCanceledException Thrown when awaiting a component-task that gets cancelled. Can happen if you are awaiting a component that gets destroyed. InactiveGameObjectException Thrown when attempting to start a task on a disabled gameobject. InactiveComponentException Thrown when attempting to start a task on a disabled component. Does not happen when giving UpdateWhileComponentDisabled flag. StartTask(Component, Func>, TIn, TaskRunOptions) Start a task scoped to the given component. Declaration public static Task StartTask(this Component component, Func> taskCreator, TIn data, TaskRunOptions options = TaskRunOptions.Default) Parameters Type Name Description Component component Component to run the task 'on'. System.Func > taskCreator Function for creating the task. TIn data TaskRunOptions options Options for configuring how the task is run. Returns Type Description System.Threading.Tasks.Task Task that completes when the original task completes or when the component gets destroyed. Type Parameters Name Description TIn TOut Remarks The task will run 'on' the component, meaning that the task gets paused when the component is disabled and the task will get cancelled when the component is destroyed. Can only be called from the unity-thread in play-mode. Exceptions Type Condition NotPlayingException Thrown when called in edit-mode. NonUnityThreadException Thrown when called from a non-unity thread. TaskCreatorReturnedNullException Thrown when null is returned from the 'taskCreator'. ComponentTaskCanceledException Thrown when awaiting a component-task that gets cancelled. Can happen if you are awaiting a component that gets destroyed. InactiveGameObjectException Thrown when attempting to start a task on a disabled gameobject. InactiveComponentException Thrown when attempting to start a task on a disabled component. Does not happen when giving UpdateWhileComponentDisabled flag." + }, + "api/ComponentTask.LocalTaskRunner.html": { + "href": "api/ComponentTask.LocalTaskRunner.html", + "title": "Class LocalTaskRunner | ComponentTask", + "keywords": "Class LocalTaskRunner TaskRunner that you can 'tick' manually. Inheritance System.Object LocalTaskRunner Implements ITaskRunner System.IDisposable Inherited Members System.Object.Equals(System.Object) System.Object.Equals(System.Object, System.Object) System.Object.GetHashCode() System.Object.GetType() System.Object.MemberwiseClone() System.Object.ToString() System.Object.ReferenceEquals(System.Object, System.Object) Namespace : ComponentTask Assembly : cs.temp.dll.dll Syntax public sealed class LocalTaskRunner : ITaskRunner, IDisposable Constructors LocalTaskRunner(IExceptionHandler) Construct a new instance of the LocalTaskRunner class. Declaration public LocalTaskRunner(IExceptionHandler exceptionHandler) Parameters Type Name Description IExceptionHandler exceptionHandler Handler to use when exception occur in tasks. Methods AssertRunningTaskCount(Int32) Valid in 'DEBUG' only, useful for tests. Declaration public void AssertRunningTaskCount(int expectedCount) Parameters Type Name Description System.Int32 expectedCount Dispose() Declaration public void Dispose() Execute() Execute all the work that was 'scheduled' by the tasks running on this runner. Declaration public void Execute() StartTask(Func) Start a task on this runner. that is passed to the task-creator is cancelled when the runner is disposed, this can be usefull for cancelling external processes. Declaration public Task StartTask(Func taskCreator) Parameters Type Name Description System.Func < CancellationToken , System.Threading.Tasks.Task > taskCreator Function for creating the task. Returns Type Description System.Threading.Tasks.Task Task that completes when the original task completes or when the runner gets disposed. Exceptions Type Condition TaskCreatorReturnedNullException Thrown when null is returned from the 'taskCreator'. ComponentTaskCanceledException Thrown when awaiting a component-task that gets cancelled. Can happen if you are awaiting a component that gets destroyed. StartTask(Func, IDiagnosticLogger) Declaration public Task StartTask(Func taskCreator, IDiagnosticLogger logger) Parameters Type Name Description System.Func < CancellationToken , System.Threading.Tasks.Task > taskCreator IDiagnosticLogger logger Optional logger to output diagnostic messages to. Returns Type Description System.Threading.Tasks.Task StartTask(Func) Start a task on this runner. Declaration public Task StartTask(Func taskCreator) Parameters Type Name Description System.Func < System.Threading.Tasks.Task > taskCreator Function for creating the task. Returns Type Description System.Threading.Tasks.Task Task that completes when the original task completes or when the runner gets disposed. Exceptions Type Condition TaskCreatorReturnedNullException Thrown when null is returned from the 'taskCreator'. ComponentTaskCanceledException Thrown when awaiting a component-task that gets cancelled. StartTask(Func, IDiagnosticLogger) Declaration public Task StartTask(Func taskCreator, IDiagnosticLogger logger) Parameters Type Name Description System.Func < System.Threading.Tasks.Task > taskCreator IDiagnosticLogger logger Optional logger to output diagnostic messages to. Returns Type Description System.Threading.Tasks.Task StartTask(Func, TIn) Declaration public Task StartTask(Func taskCreator, TIn data) Parameters Type Name Description System.Func taskCreator TIn data Returns Type Description System.Threading.Tasks.Task Type Parameters Name Description TIn StartTask(Func, TIn, IDiagnosticLogger) Declaration public Task StartTask(Func taskCreator, TIn data, IDiagnosticLogger logger) Parameters Type Name Description System.Func taskCreator TIn data IDiagnosticLogger logger Optional logger to output diagnostic messages to. Returns Type Description System.Threading.Tasks.Task Type Parameters Name Description TIn StartTask(Func, TIn) Declaration public Task StartTask(Func taskCreator, TIn data) Parameters Type Name Description System.Func taskCreator TIn data Returns Type Description System.Threading.Tasks.Task Type Parameters Name Description TIn StartTask(Func, TIn, IDiagnosticLogger) Declaration public Task StartTask(Func taskCreator, TIn data, IDiagnosticLogger logger) Parameters Type Name Description System.Func taskCreator TIn data IDiagnosticLogger logger Optional logger to output diagnostic messages to. Returns Type Description System.Threading.Tasks.Task Type Parameters Name Description TIn StartTask(Func>) Declaration public Task StartTask(Func> taskCreator) Parameters Type Name Description System.Func < CancellationToken , System.Threading.Tasks.Task > taskCreator Returns Type Description System.Threading.Tasks.Task Type Parameters Name Description TOut StartTask(Func>, IDiagnosticLogger) Declaration public Task StartTask(Func> taskCreator, IDiagnosticLogger logger) Parameters Type Name Description System.Func < CancellationToken , System.Threading.Tasks.Task > taskCreator IDiagnosticLogger logger Optional logger to output diagnostic messages to. Returns Type Description System.Threading.Tasks.Task Type Parameters Name Description TOut StartTask(Func>) Declaration public Task StartTask(Func> taskCreator) Parameters Type Name Description System.Func < System.Threading.Tasks.Task > taskCreator Returns Type Description System.Threading.Tasks.Task Type Parameters Name Description TOut StartTask(Func>, IDiagnosticLogger) Declaration public Task StartTask(Func> taskCreator, IDiagnosticLogger logger) Parameters Type Name Description System.Func < System.Threading.Tasks.Task > taskCreator IDiagnosticLogger logger Optional logger to output diagnostic messages to. Returns Type Description System.Threading.Tasks.Task Type Parameters Name Description TOut StartTask(Func>, TIn) Declaration public Task StartTask(Func> taskCreator, TIn data) Parameters Type Name Description System.Func > taskCreator TIn data Returns Type Description System.Threading.Tasks.Task Type Parameters Name Description TIn TOut StartTask(Func>, TIn, IDiagnosticLogger) Declaration public Task StartTask(Func> taskCreator, TIn data, IDiagnosticLogger logger) Parameters Type Name Description System.Func > taskCreator TIn data IDiagnosticLogger logger Optional logger to output diagnostic messages to. Returns Type Description System.Threading.Tasks.Task Type Parameters Name Description TIn TOut StartTask(Func>, TIn) Declaration public Task StartTask(Func> taskCreator, TIn data) Parameters Type Name Description System.Func > taskCreator TIn data Returns Type Description System.Threading.Tasks.Task Type Parameters Name Description TIn TOut StartTask(Func>, TIn, IDiagnosticLogger) Declaration public Task StartTask(Func> taskCreator, TIn data, IDiagnosticLogger logger) Parameters Type Name Description System.Func > taskCreator TIn data IDiagnosticLogger logger Optional logger to output diagnostic messages to. Returns Type Description System.Threading.Tasks.Task Type Parameters Name Description TIn TOut Implements ITaskRunner System.IDisposable" } } \ No newline at end of file diff --git a/docs/install.html b/docs/install.html index a77999b..eecd2df 100644 --- a/docs/install.html +++ b/docs/install.html @@ -8,7 +8,7 @@ Installation | ComponentTask - + @@ -87,7 +87,7 @@

Add package

commit.

Upgrading

To update to a newer version simply open your package manifest (Packages/manifest.json) and set -the tag at the end of the git url (for example v1.8.1) to a later version.

+the tag at the end of the git url (for example v1.8.2) to a later version.

diff --git a/docs/manifest.json b/docs/manifest.json index 2625916..9d148a8 100644 --- a/docs/manifest.json +++ b/docs/manifest.json @@ -18,7 +18,7 @@ "output": { ".html": { "relative_path": "api/ComponentTask.Config.html", - "hash": "LKi/fXL93FUOHI5fHfEJUw==" + "hash": "CzORmqixMPEmN8qCw1v16A==" } }, "is_incremental": false, @@ -30,7 +30,7 @@ "output": { ".html": { "relative_path": "api/ComponentTask.Exceptions.ComponentTaskCanceledException.html", - "hash": "Xa1y07mB8ITZgEoBKWunkA==" + "hash": "lvcBMS0TunsSxIwxbGIAKg==" } }, "is_incremental": false, @@ -42,7 +42,7 @@ "output": { ".html": { "relative_path": "api/ComponentTask.Exceptions.ContextChangedException.html", - "hash": "ahHtNWQtLq0A5p6yIpHedg==" + "hash": "fRPYbWURAKTStsIdvQCVsw==" } }, "is_incremental": false, @@ -54,7 +54,7 @@ "output": { ".html": { "relative_path": "api/ComponentTask.Exceptions.InactiveComponentException.html", - "hash": "LKWBv29I9hR4K+I+cIZBlw==" + "hash": "0S61Kv3GiweGmWqOGl1PNw==" } }, "is_incremental": false, @@ -66,7 +66,7 @@ "output": { ".html": { "relative_path": "api/ComponentTask.Exceptions.InactiveGameObjectException.html", - "hash": "FmAsIQGkgtwtzoqXQql+UQ==" + "hash": "v7jn77+IXX5ejPYT55sIYw==" } }, "is_incremental": false, @@ -78,7 +78,7 @@ "output": { ".html": { "relative_path": "api/ComponentTask.Exceptions.NonUnityThreadException.html", - "hash": "t19Rv9vyLULv/3muPiZmdw==" + "hash": "XaxvhPLwIYBwZpUpzcnUVA==" } }, "is_incremental": false, @@ -90,7 +90,7 @@ "output": { ".html": { "relative_path": "api/ComponentTask.Exceptions.NotPlayingException.html", - "hash": "vyT2dO0yPcmoEtc7oO+77A==" + "hash": "TaglywOoslkn8o3n/qtWDQ==" } }, "is_incremental": false, @@ -102,7 +102,7 @@ "output": { ".html": { "relative_path": "api/ComponentTask.Exceptions.TaskCreatorReturnedNullException.html", - "hash": "v9OTQ1CRyDLNsTGAmPbMCg==" + "hash": "1N66cFLyfFvwtsdPPu8C2g==" } }, "is_incremental": false, @@ -114,7 +114,7 @@ "output": { ".html": { "relative_path": "api/ComponentTask.Exceptions.html", - "hash": "ZZbt21zxukLtYtOIIUX6LA==" + "hash": "p3i9r7d2DjR7vKXHBNP0Wg==" } }, "is_incremental": false, @@ -126,7 +126,7 @@ "output": { ".html": { "relative_path": "api/ComponentTask.IDiagnosticLogger.html", - "hash": "eaTk+HuboW58Q1RyN4UEwA==" + "hash": "ecIQ1GPeUy/1rUWwJtkwsA==" } }, "is_incremental": false, @@ -138,7 +138,7 @@ "output": { ".html": { "relative_path": "api/ComponentTask.IExceptionHandler.html", - "hash": "nzF8EBq6suCEOybdVJzJQQ==" + "hash": "cUJyRLRrG9WRPiQ5jI7vgg==" } }, "is_incremental": false, @@ -150,7 +150,7 @@ "output": { ".html": { "relative_path": "api/ComponentTask.ITaskRunner.html", - "hash": "YGWyUMShRHIKl2gQyFNoxg==" + "hash": "V7UZcNTTZ2lDQUwprkxBjQ==" } }, "is_incremental": false, @@ -162,7 +162,7 @@ "output": { ".html": { "relative_path": "api/ComponentTask.LocalTaskRunner.html", - "hash": "M8b5/O3pGqNArPa2iTg8uw==" + "hash": "OuTl5Ke/2/lhaVeeoe+kmQ==" } }, "is_incremental": false, @@ -174,7 +174,7 @@ "output": { ".html": { "relative_path": "api/ComponentTask.html", - "hash": "PDet/H4PSxfg4GM4rCX2Ng==" + "hash": "cvAqIRZrmDxOkZ5YRJ4ByQ==" } }, "is_incremental": false, @@ -186,7 +186,7 @@ "output": { ".html": { "relative_path": "api/UnityEngine.ComponentExtensions.html", - "hash": "xVxJiiNan7xK570m6PQbgg==" + "hash": "9raFJLvPP+zGukdX7yqi2g==" } }, "is_incremental": false, @@ -198,7 +198,7 @@ "output": { ".html": { "relative_path": "api/UnityEngine.GameObjectExtensions.html", - "hash": "fImKz/9ivn2D4Qd48E2/sg==" + "hash": "Tv3iuZKB1lJhjVsLUd2XzA==" } }, "is_incremental": false, @@ -210,7 +210,7 @@ "output": { ".html": { "relative_path": "api/UnityEngine.TaskExtensions.html", - "hash": "ZCS+jvhodk3Wm1c4MpEfew==" + "hash": "ZHM52fkvUn/i5BsA6qReBQ==" } }, "is_incremental": false, @@ -222,7 +222,7 @@ "output": { ".html": { "relative_path": "api/UnityEngine.TaskRunOptions.html", - "hash": "S7MzZzwYHBFJ65Fr3AtE9g==" + "hash": "Z6ZFiTA2jYfBudY/t66mrA==" } }, "is_incremental": false, @@ -234,7 +234,7 @@ "output": { ".html": { "relative_path": "api/UnityEngine.html", - "hash": "gY/m5pXmPa5pKKCSqQOjFg==" + "hash": "zcv2AAGGvuhvGneAH3m3Dg==" } }, "is_incremental": false, @@ -249,7 +249,7 @@ "output": { ".html": { "relative_path": "api/index.html", - "hash": "RJMlCgTDRdQ/c5yo0kQTVw==" + "hash": "EqULPo9pG/dk7fIGqmHKDw==" } }, "is_incremental": false, @@ -261,7 +261,7 @@ "output": { ".html": { "relative_path": "api/toc.html", - "hash": "YCo5e5gGfwqpAn19pDE8Dg==" + "hash": "SoAi5YR0PXeG3lKVUUOmmg==" } }, "is_incremental": false, @@ -273,7 +273,7 @@ "output": { ".html": { "relative_path": "examples.html", - "hash": "urzL49nTzItxfUDH53XUYQ==" + "hash": "ZPqpNfY4+zrX54z3XXULkw==" } }, "is_incremental": false, @@ -285,7 +285,7 @@ "output": { ".html": { "relative_path": "how-to.html", - "hash": "DfkCL5cnS5kJJS/NgGNlNw==" + "hash": "mXZUKBFqlstsvV+kPNYv8g==" } }, "is_incremental": false, @@ -297,7 +297,7 @@ "output": { ".html": { "relative_path": "index.html", - "hash": "57q0trhUX+h1DXt5zG+L7A==" + "hash": "KX+ZG+vVdmXjd9eUPCUrRA==" } }, "is_incremental": false, @@ -309,7 +309,7 @@ "output": { ".html": { "relative_path": "install.html", - "hash": "fz+ysIDc01d3ISaAiSs/Vw==" + "hash": "rEFao8gLamPlVTdi/Cs8Gw==" } }, "is_incremental": false, @@ -321,7 +321,7 @@ "output": { ".html": { "relative_path": "toc.html", - "hash": "3ZrENHlW6/3tPWzbBNMAUA==" + "hash": "bXkBmfER4OzAQaYHcrKEhg==" } }, "is_incremental": false, @@ -332,7 +332,7 @@ { "status": { "can_incremental": false, - "details": "Cannot build incrementally because docfx version changed from 2.43.3.0 to 2.44.0.0.", + "details": "Cannot build incrementally because docfx version changed from 2.44.0.0 to 2.47.0.0.", "incrementalPhase": "build", "total_file_count": 0, "skipped_file_count": 0, @@ -346,16 +346,16 @@ "total_file_count": 0, "skipped_file_count": 0 }, - "ManagedReferenceDocumentProcessor": { + "ConceptualDocumentProcessor": { "can_incremental": false, "incrementalPhase": "build", - "total_file_count": 19, + "total_file_count": 5, "skipped_file_count": 0 }, - "ConceptualDocumentProcessor": { + "ManagedReferenceDocumentProcessor": { "can_incremental": false, "incrementalPhase": "build", - "total_file_count": 5, + "total_file_count": 19, "skipped_file_count": 0 } } diff --git a/docs/styles/docfx.css b/docs/styles/docfx.css index 3235be4..5183011 100644 --- a/docs/styles/docfx.css +++ b/docs/styles/docfx.css @@ -562,6 +562,7 @@ body .toc{ border: 0; color: #666666; padding-left: 20px; + padding-right: 20px; width: 100%; } .toc-filter > input:focus { @@ -572,6 +573,11 @@ body .toc{ top: 10px; left: 5px; } +.toc-filter > .clear-icon { + position: absolute; + top: 10px; + right: 5px; +} .article { margin-top: 120px; margin-bottom: 115px; diff --git a/docs/styles/docfx.js b/docs/styles/docfx.js index e9920dd..74ae400 100644 --- a/docs/styles/docfx.js +++ b/docs/styles/docfx.js @@ -434,20 +434,29 @@ $(function () { } function registerTocEvents() { + var tocFilterInput = $('#toc_filter_input'); + var tocFilterClearButton = $('#toc_filter_clear'); + $('.toc .nav > li > .expand-stub').click(function (e) { $(e.target).parent().toggleClass(expanded); }); $('.toc .nav > li > .expand-stub + a:not([href])').click(function (e) { $(e.target).parent().toggleClass(expanded); }); - $('#toc_filter_input').on('input', function (e) { + tocFilterInput.on('input', function (e) { var val = this.value; + //Save filter string to local session storage + if (typeof(Storage) !== "undefined") { + sessionStorage.filterString = val; + } if (val === '') { // Clear 'filtered' class $('#toc li').removeClass(filtered).removeClass(hide); + tocFilterClearButton.fadeOut(); return; } - + tocFilterClearButton.fadeIn(); + // Get leaf nodes $('#toc li>a').filter(function (i, e) { return $(e).siblings().length === 0 @@ -488,6 +497,22 @@ $(function () { return false; } }); + + // toc filter clear button + tocFilterClearButton.hide(); + tocFilterClearButton.on("click", function(e){ + tocFilterInput.val(""); + tocFilterInput.trigger('input'); + if (typeof(Storage) !== "undefined") { + sessionStorage.filterString = ""; + } + }); + + //Set toc filter from local session storage on page load + if (typeof(Storage) !== "undefined") { + tocFilterInput.val(sessionStorage.filterString); + tocFilterInput.trigger('input'); + } } function loadToc() { diff --git a/docs/styles/search-worker.js b/docs/styles/search-worker.js index 8128718..d10eba1 100644 --- a/docs/styles/search-worker.js +++ b/docs/styles/search-worker.js @@ -6,7 +6,7 @@ var stopWords = null; var searchData = {}; - lunr.tokenizer.seperator = /[\s\-\.]+/; + lunr.tokenizer.separator = /[\s\-\.]+/; var stopWordsRequest = new XMLHttpRequest(); stopWordsRequest.open('GET', '../search-stopwords.json'); diff --git a/docs/toc.html b/docs/toc.html index e1095f2..a2ea584 100644 --- a/docs/toc.html +++ b/docs/toc.html @@ -4,6 +4,7 @@
+
diff --git a/package.json b/package.json index b74206b..9bed228 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "com.bastianblokland.componenttask", "displayName": "ComponentTask", "author": "Bastian Blokland", - "version": "1.8.1", + "version": "1.8.2", "unity": "2019.2", "description": "Library for running dotnet 'Task' and 'Task' scoped to Unity components. Repository: https://github.com/BastianBlokland/componenttask-unity", "repository": {