You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// - When attaching, the <see cref="AttachableNode"/>'s <see cref="AttachableNode.OnAttached(AttachableBehaviour)"/> is invoked just before the <see cref="OnAttachStateChanged"/> is invoked with the <see cref="AttachState.Attached"/> state.<br />
24
+
/// - When detaching, the <see cref="AttachableNode"/>'s <see cref="AttachableNode.OnDetached(AttachableBehaviour)"/> is invoked right after the <see cref="OnAttachStateChanged"/> is invoked with the <see cref="AttachState.Detached"/> notification.<br />
Copy file name to clipboardExpand all lines: com.unity.netcode.gameobjects/Runtime/Components/Helpers/ComponentController.cs
+135-5Lines changed: 135 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,5 @@
1
1
usingSystem;
2
+
usingSystem.Collections;
2
3
usingSystem.Collections.Generic;
3
4
usingSystem.Reflection;
4
5
usingUnityEngine;
@@ -16,8 +17,19 @@ public class ComponentControllerEntry
16
17
/// When true, this component's enabled state will be the inverse of
17
18
/// the value passed into <see cref="ComponentController.SetEnabled(bool)"/>.
18
19
/// </summary>
20
+
[Tooltip("When enabled, this component will inversely mirror the currently applied enable or disable state.")]
19
21
publicboolInvertEnabled;
20
22
23
+
/// <summary>
24
+
/// The amount of time to delay enabling this component when the <see cref="ComponentController"/> has just transitioned from a disabled to enabled state.
25
+
/// </summary>
26
+
publicfloatEnableDelay;
27
+
28
+
/// <summary>
29
+
/// The amount of time to delay disabling this component when the <see cref="ComponentController"/> has just transitioned from an enabled to disabled state.
30
+
/// </summary>
31
+
publicfloatDisableDelay;
32
+
21
33
/// <summary>
22
34
/// The component to control.
23
35
/// </summary>
@@ -27,8 +39,63 @@ public class ComponentControllerEntry
27
39
/// and <see cref="InvertEnabled"/> properties will be applied to all components found on the <see cref="GameObject"/>.
@@ -52,6 +119,17 @@ public class ComponentController : NetworkBehaviour
52
119
[Tooltip("The initial state of the component controllers enabled status when instnatiated.")]
53
120
publicboolStartEnabled=true;
54
121
122
+
/// <summary>
123
+
/// The coroutine yield time used to check on any pending delayed <see cref="ComponentControllerEntry"/> state transitions.
124
+
/// </summary>
125
+
/// <remarks>
126
+
/// If there are any <see cref="ComponentControllerEntry"/> delays (enable, disable, or both), then upon changing the state of a <see cref="ComponentController"/> a coroutine will be started
127
+
/// (if not already started) that will monitor any pending delayed transitions (<see cref="EnableDelay"/> or <see cref="DisableDelay"/>) and will
128
+
/// handle changing each delayed <see cref="ComponentControllerEntry"/> until all instances have transitioned their value to the pending state change.
129
+
/// When there are no more pending delayed <see cref="ComponentControllerEntry"/>s, the coroutine will stop.
130
+
/// </remarks>
131
+
publicfloatPendingDelayYieldTime=0.032f;
132
+
55
133
/// <summary>
56
134
/// The list of <see cref="Components"/>s to be enabled and disabled.
57
135
/// </summary>
@@ -214,6 +292,17 @@ public override void OnNetworkDespawn()
0 commit comments