Struct TweenID
An immutable, type-safe numeric identifier that uniquely identifies a single tween instance within the Scylla Tween system.
Implements
Inherited Members
Namespace: Scylla.Core.Util.Tween
Assembly: ScyllaCore.dll
Syntax
public readonly struct TweenID : IEquatable<TweenID>
Remarks
TweenID wraps a long counter value that is incremented atomically
via Increment(ref int) each time
Generate() is called, guaranteeing uniqueness across threads for the
lifetime of the application domain.
The sentinel value None (internal value 0) is used to
represent the absence of a valid ID. Check IsValid before using an
ID obtained from an untrusted source (e.g. from a TweenException).
TweenID is a readonly struct; it is value-type equality-comparable
and can be safely stored in dictionaries as a key via its
GetHashCode() and Equals(TweenID) implementations.
Typical usage - store the ID when creating a tween and use it later to look up or cancel the animation:
<pre><code class="lang-csharp">var tween = ScyllaTween.To(...).SetManaged(true).Play();
var id = tween.ID;
// Later, look up and cancel: var found = ScyllaTween.GetTween(id); found?.Kill();
Properties
IsValid
Gets whether this TweenID represents a real tween rather than the
None sentinel.
Declaration
public bool IsValid { get; }
Property Value
| Type | Description |
|---|---|
| bool |
|
None
Gets a sentinel TweenID that represents the absence of a valid identifier.
Declaration
public static TweenID None { get; }
Property Value
| Type | Description |
|---|---|
| TweenID | A |
Value
Gets the raw numeric value that backs this identifier.
Declaration
public long Value { get; }
Property Value
| Type | Description |
|---|---|
| long | A positive |
Methods
Equals(TweenID)
Determines whether this TweenID is equal to another TweenID.
Declaration
public bool Equals(TweenID other)
Parameters
| Type | Name | Description |
|---|---|---|
| TweenID | other | The |
Returns
| Type | Description |
|---|---|
| bool |
|
Equals(object)
Declaration
public override bool Equals(object obj)
Parameters
| Type | Name | Description |
|---|---|---|
| object | obj |
Returns
| Type | Description |
|---|---|
| bool |
Overrides
FromValue(long)
Creates a TweenID from a specific numeric value without incrementing the
global counter.
Declaration
public static TweenID FromValue(long value)
Parameters
| Type | Name | Description |
|---|---|---|
| long | value | The numeric value to wrap. Passing |
Returns
| Type | Description |
|---|---|
| TweenID | A |
Remarks
Use this only in controlled scenarios such as serialization round-trips or testing. Prefer Generate() for all normal tween creation paths.
Generate()
Generates a new globally unique TweenID by atomically incrementing the
shared counter.
Declaration
public static TweenID Generate()
Returns
| Type | Description |
|---|---|
| TweenID | A |
Remarks
Uses Increment(ref int) to ensure thread safety. This is the preferred way to obtain a new ID for a freshly constructed or pool-reset tween.
GetHashCode()
Declaration
public override int GetHashCode()
Returns
| Type | Description |
|---|---|
| int |
Overrides
ToString()
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| string |
Overrides
Operators
operator ==(TweenID, TweenID)
Returns true when both TweenID instances wrap the same numeric
value.
Declaration
public static bool operator ==(TweenID left, TweenID right)
Parameters
| Type | Name | Description |
|---|---|---|
| TweenID | left | The left-hand operand. |
| TweenID | right | The right-hand operand. |
Returns
| Type | Description |
|---|---|
| bool |
|
operator !=(TweenID, TweenID)
Returns true when the two TweenID instances wrap different numeric
values.
Declaration
public static bool operator !=(TweenID left, TweenID right)
Parameters
| Type | Name | Description |
|---|---|---|
| TweenID | left | The left-hand operand. |
| TweenID | right | The right-hand operand. |
Returns
| Type | Description |
|---|---|
| bool |
|