Skip to content

Commit 9ee8b9b

Browse files
Merge pull request #2 from sator-imaging/active/v0.9
Active/v0.9
2 parents 2476854 + 62d53c0 commit 9ee8b9b

File tree

3 files changed

+19
-17
lines changed

3 files changed

+19
-17
lines changed

LifecycleBehaviour.cs

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
/** Simple Lifecycle Manager for Unity
1+
/** CancellationToken based Lifecycle Manager for Unity
22
** (c) 2024 github.com/sator-imaging
33
** Licensed under the MIT License
44
5-
This library helps managing MonoBehaviour lifetime by CancellationToken introduced in Unity 2022.
5+
This library helps managing MonoBehaviour lifetime by `CancellationToken` introduced in Unity 2022.
66
Not only that but also has an ability to manage "Update" actions ordered and efficiently.
77
88
And also! library provides missing `destroyCancellationToken` feature for Unity 2021 LTS!!
99
1010
**Feature Highlights**
11-
- [Class Instance Lifetime Management](#object-lifetime-management)
11+
- [Object Lifetime Management](#object-lifetime-management)
1212
- [Update Function Manager](#update-function-manager)
1313
- Designed to address consideration written in the following article
1414
- https://blog.unity.com/engine-platform/10000-update-calls
@@ -101,7 +101,7 @@ Note that C# class instances and GameObjects destruction order is stable whereas
101101
when scene is unloaded otherwise destroyed based on binding order.
102102
103103
> [!NOTE]
104-
> To make destruction order stable, extension method automatically mark lifetime bound GameObjects as
104+
> To make destruction order stable, extension method automatically marks lifetime bound GameObjects as
105105
> `DontDestroyOnLoad`.
106106
107107
@@ -512,12 +512,12 @@ public void Clear()
512512
/// Do nothing when null action specified.
513513
/// </remarks>
514514
/// <returns>
515-
/// Returns received action instance as-is. It is null when null is passed.
516515
/// <para>
516+
/// Returns received action instance as-is. It is null when null is passed.
517+
/// </para>
517518
/// > [!NOTE]
518519
/// > `Add(instance.Method)` will create new Action instance call by call implicitly.
519-
/// > If try to remove action later, it requires to specify exactly same instance so need to keep returned instance.
520-
/// </para>
520+
/// > If plan to remove action later, removing requires exactly same instance so need to keep returned one.
521521
/// </returns>
522522
public Action Add(Action act)
523523
{
@@ -540,11 +540,11 @@ public Action Add(Action act)
540540
}
541541

542542
/// <remarks>
543-
/// Do nothing when null action specified.
544543
/// <para>
544+
/// Do nothing when null action specified.
545+
/// </para>
545546
/// > [!WARNING]
546547
/// > Item order will be changed. See file header document for details.
547-
/// </para>
548548
/// </remarks>
549549
public void Remove(Action act)
550550
{
@@ -611,12 +611,12 @@ internal SceneLifetime(Scene scene)
611611
{
612612
if (_sceneToLifetime.ContainsKey(scene))
613613
{
614-
throw new InvalidOperationException(
614+
throw new ArgumentException(
615615
LOG_PREFIX + "scene lifetime has already been created. use `Get` method instead: " + scene);
616616
}
617617

618618
if (!scene.IsValid())
619-
throw new NotSupportedException(LOG_PREFIX + "scene is invalid: " + scene);
619+
throw new ArgumentException(LOG_PREFIX + "scene is invalid: " + scene);
620620

621621
_sceneInfo = "BuildIndex:" + scene.buildIndex + " " + scene.name;
622622
_sceneToLifetime.Add(scene, this);
@@ -745,7 +745,7 @@ public static class LifetimeExtensions
745745
/// <summary>
746746
/// Arguments: (obj, token, ticket, ownerOrNull)
747747
/// <para>
748-
/// Invoked before object bound to token.
748+
/// Invoked when object bound to token or lifetime owner.
749749
/// </para>
750750
/// </summary>
751751
public static Action<object, CancellationToken, CancellationTokenRegistration, object?>? DebuggerAction

README.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
This library helps managing MonoBehaviour lifetime by CancellationToken introduced in Unity 2022.
1+
# CancellationToken based Lifecycle Manager for Unity
2+
3+
This library helps managing MonoBehaviour lifetime by `CancellationToken` introduced in Unity 2022.
24
Not only that but also has an ability to manage "Update" actions ordered and efficiently.
35

46
And also! library provides missing `destroyCancellationToken` feature for Unity 2021 LTS!!
57

68
**Feature Highlights**
7-
- [Class Instance Lifetime Management](#object-lifetime-management)
9+
- [Object Lifetime Management](#object-lifetime-management)
810
- [Update Function Manager](#update-function-manager)
911
- Designed to address consideration written in the following article
1012
- https://blog.unity.com/engine-platform/10000-update-calls
@@ -97,7 +99,7 @@ destruction order is NOT stable. For reference, MonoBehaviours (components) will
9799
when scene is unloaded otherwise destroyed based on binding order.
98100

99101
> [!NOTE]
100-
> To make destruction order stable, extension method automatically mark lifetime bound GameObjects as
102+
> To make destruction order stable, extension method automatically marks lifetime bound GameObjects as
101103
> `DontDestroyOnLoad`.
102104
103105

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"name": "com.sator-imaging.unity-lifecycle-manager",
3-
"displayName": "MonoBehaviour Lifecycle Manager",
3+
"displayName": "CancellationToken based Lifecycle Manager",
44
"version": "0.9.0",
55
"unity": "2021.3",
6-
"description": "MonoBehaviour lifecycle and update function manager.",
6+
"description": "Provides MonoBehaviour update function manager component and CancellationToken based object lifetime management.",
77
"author": {
88
"name": "Sator Imaging",
99
"url": "https://twitter.com/sator_imaging"

0 commit comments

Comments
 (0)