|
UsoUIElements 0.1.0
Data Centric implimentation of Unity's UI Elements (UI Toolkit)
|
A Unity-serializable wrapper for System.Guid that provides globally unique identifier functionality with full Unity Editor and runtime support. This structure stores GUID data as four 32-bit unsigned integers to ensure proper serialization and Inspector display while maintaining compatibility with standard .NET Guid operations. More...
Public Member Functions | |
| SerializableGuid (Guid guid) | |
| Initializes a new SerializableGuid instance from an existing System.Guid. This constructor enables conversion from standard .NET GUIDs to the serializable format. | |
| SerializableGuid (uint val1, uint val2, uint val3, uint val4) | |
| Initializes a new SerializableGuid instance with the specified four 32-bit unsigned integer parts. This constructor allows direct specification of the internal GUID representation. | |
| override bool | Equals (object obj) |
| Determines whether the specified object is equal to this SerializableGuid instance. This method provides object-level equality comparison with type checking. | |
| bool | Equals (SerializableGuid other) |
| Determines whether this SerializableGuid instance is equal to another SerializableGuid. This method provides strongly-typed equality comparison by comparing all four data parts. | |
| override int | GetHashCode () |
| Generates a hash code for this SerializableGuid instance based on all four data parts. This method enables the use of SerializableGuid as dictionary keys and in hash-based collections. | |
| Guid | ToGuid () |
| Converts the SerializableGuid to a standard System.Guid instance. This method enables interoperability with .NET APIs that expect System.Guid parameters. | |
| string | ToHexString () |
| Converts the SerializableGuid to a 32-character uppercase hexadecimal string representation. This method provides a compact string format suitable for debugging, logging, or data storage. | |
Static Public Member Functions | |
| static SerializableGuid | FromHexString (string hexString) |
| Creates a SerializableGuid from a 32-character hexadecimal string representation. This method parses hex strings without delimiters into SerializableGuid instances. | |
| static SerializableGuid | NewGuid () |
| Creates a new SerializableGuid with a cryptographically strong random value. This method is equivalent to System.Guid.NewGuid() but returns a SerializableGuid. | |
| static implicit | operator Guid (SerializableGuid serializableGuid) |
| Implicitly converts a SerializableGuid to a System.Guid. This operator enables seamless use of SerializableGuid instances where System.Guid is expected. | |
| static implicit | operator SerializableGuid (Guid guid) |
| Implicitly converts a System.Guid to a SerializableGuid. This operator enables seamless creation of SerializableGuid instances from System.Guid values. | |
| static bool | operator!= (SerializableGuid left, SerializableGuid right) |
| Determines whether two SerializableGuid instances are not equal. This operator provides intuitive inequality comparison using the != syntax. | |
| static bool | operator== (SerializableGuid left, SerializableGuid right) |
| Determines whether two SerializableGuid instances are equal. This operator provides intuitive equality comparison using the == syntax. | |
Public Attributes | |
| uint | Part1 |
| The first 32-bit portion of the GUID data. | |
| uint | Part2 |
| The second 32-bit portion of the GUID data. | |
| uint | Part3 |
| The third 32-bit portion of the GUID data. | |
| uint | Part4 |
| The fourth 32-bit portion of the GUID data. | |
Properties | |
| static SerializableGuid | Empty [get] |
| Gets a SerializableGuid instance that represents an empty GUID (all zeros). This is equivalent to System.Guid.Empty but for the serializable version. | |
A Unity-serializable wrapper for System.Guid that provides globally unique identifier functionality with full Unity Editor and runtime support. This structure stores GUID data as four 32-bit unsigned integers to ensure proper serialization and Inspector display while maintaining compatibility with standard .NET Guid operations.
The standard .NET Guid struct is not serializable by Unity, making it unsuitable for use in MonoBehaviour fields or ScriptableObjects. This SerializableGuid provides a solution by breaking the GUID into four serializable parts while maintaining full functional compatibility.
Key features:
The internal representation uses four 32-bit unsigned integers that map directly to the 16-byte GUID structure, ensuring perfect fidelity when converting to and from System.Guid instances.
| GWG.UsoUIElements.Utilities.SerializableGuid.SerializableGuid | ( | uint | val1, |
| uint | val2, | ||
| uint | val3, | ||
| uint | val4 ) |
Initializes a new SerializableGuid instance with the specified four 32-bit unsigned integer parts. This constructor allows direct specification of the internal GUID representation.
| val1 | The first 32-bit portion of the GUID data. |
| val2 | The second 32-bit portion of the GUID data. |
| val3 | The third 32-bit portion of the GUID data. |
| val4 | The fourth 32-bit portion of the GUID data. |
This constructor is useful for creating SerializableGuids from known values or for testing purposes. The four parameters represent the complete 128-bit GUID data split into four 32-bit segments. This is the most direct way to construct a SerializableGuid when you have the raw data components.
| GWG.UsoUIElements.Utilities.SerializableGuid.SerializableGuid | ( | Guid | guid | ) |
Initializes a new SerializableGuid instance from an existing System.Guid. This constructor enables conversion from standard .NET GUIDs to the serializable format.
| guid | The System.Guid to convert to a SerializableGuid. |
This constructor breaks down the 16-byte GUID structure into four 32-bit unsigned integers for Unity serialization compatibility. The conversion is lossless and maintains perfect fidelity with the original GUID data. The byte order is preserved to ensure correct reconstruction. This constructor is commonly used when interfacing with .NET APIs that return System.Guid instances.
| override bool GWG.UsoUIElements.Utilities.SerializableGuid.Equals | ( | object | obj | ) |
Determines whether the specified object is equal to this SerializableGuid instance. This method provides object-level equality comparison with type checking.
| obj | The object to compare with this SerializableGuid. |
This override of the Object.Equals method provides type-safe equality comparison. It first checks if the object is a SerializableGuid, then delegates to the strongly-typed Equals method. This method is essential for proper behavior in collections, dictionaries, and general object comparison scenarios.
| bool GWG.UsoUIElements.Utilities.SerializableGuid.Equals | ( | SerializableGuid | other | ) |
Determines whether this SerializableGuid instance is equal to another SerializableGuid. This method provides strongly-typed equality comparison by comparing all four data parts.
| other | The SerializableGuid to compare with this instance. |
This method implements the IEquatable<SerializableGuid> interface for efficient, type-safe comparison. Equality is determined by comparing all four 32-bit parts for exact matches. This is more efficient than converting to System.Guid for comparison and provides direct access to the comparison logic.
|
static |
Creates a SerializableGuid from a 32-character hexadecimal string representation. This method parses hex strings without delimiters into SerializableGuid instances.
| hexString | A 32-character hexadecimal string representing the GUID data. |
The hex string must be exactly 32 characters long and contain only valid hexadecimal characters (0-9, A-F). The method does not require or support GUID delimiters (hyphens or braces) - it expects a continuous hex string. If the input string is not exactly 32 characters, the method returns SerializableGuid.Empty as a safe fallback. This method is useful for deserializing GUIDs from compact string representations or database storage.
| override int GWG.UsoUIElements.Utilities.SerializableGuid.GetHashCode | ( | ) |
Generates a hash code for this SerializableGuid instance based on all four data parts. This method enables the use of SerializableGuid as dictionary keys and in hash-based collections.
The hash code is computed using all four 32-bit parts to ensure good distribution and minimize collisions. This implementation uses the .NET HashCode.Combine method for optimal hash distribution. Objects that are equal according to Equals will produce the same hash code, satisfying the GetHashCode contract. This method is essential for proper behavior when using SerializableGuid in HashSet, Dictionary, or other hash-based collections.
|
static |
Creates a new SerializableGuid with a cryptographically strong random value. This method is equivalent to System.Guid.NewGuid() but returns a SerializableGuid.
This static factory method provides the standard way to generate new unique identifiers. It uses the system's cryptographically strong random number generator to ensure uniqueness. The generated GUID follows the standard format and is suitable for use as database keys, object identifiers, or any scenario requiring guaranteed uniqueness.
|
static |
Implicitly converts a SerializableGuid to a System.Guid. This operator enables seamless use of SerializableGuid instances where System.Guid is expected.
| serializableGuid | The SerializableGuid to convert. |
This implicit conversion operator allows SerializableGuid instances to be used directly in contexts that expect System.Guid without requiring explicit conversion calls. The conversion is lossless and maintains perfect data fidelity.
|
static |
Implicitly converts a System.Guid to a SerializableGuid. This operator enables seamless creation of SerializableGuid instances from System.Guid values.
| guid | The System.Guid to convert. |
This implicit conversion operator allows System.Guid instances to be automatically converted to SerializableGuid when assigned or passed as parameters. The conversion is lossless and maintains perfect data fidelity between the two GUID representations.
|
static |
Determines whether two SerializableGuid instances are not equal. This operator provides intuitive inequality comparison using the != syntax.
| left | The first SerializableGuid to compare. |
| right | The second SerializableGuid to compare. |
This operator overload enables natural inequality comparison syntax for SerializableGuid instances. It implements the logical negation of the equality operator to ensure consistent behavior.
|
static |
Determines whether two SerializableGuid instances are equal. This operator provides intuitive equality comparison using the == syntax.
| left | The first SerializableGuid to compare. |
| right | The second SerializableGuid to compare. |
This operator overload enables natural equality comparison syntax for SerializableGuid instances. It delegates to the Equals method to ensure consistent comparison behavior across all equality mechanisms.
| Guid GWG.UsoUIElements.Utilities.SerializableGuid.ToGuid | ( | ) |
Converts the SerializableGuid to a standard System.Guid instance. This method enables interoperability with .NET APIs that expect System.Guid parameters.
The conversion reconstructs the original 16-byte GUID structure from the four 32-bit parts. This is a lossless conversion that maintains perfect fidelity with the original data. The resulting System.Guid can be used with any .NET API that requires GUID parameters. This method is automatically called by the implicit conversion operator for seamless interoperability.
| string GWG.UsoUIElements.Utilities.SerializableGuid.ToHexString | ( | ) |
Converts the SerializableGuid to a 32-character uppercase hexadecimal string representation. This method provides a compact string format suitable for debugging, logging, or data storage.
The returned string is always exactly 32 characters long and uses uppercase hexadecimal digits. Unlike the standard GUID string representation, this format omits hyphens and braces for compactness. The format is compatible with the FromHexString method for round-trip conversion. This representation is ideal for scenarios where space efficiency is important or where delimiters are problematic.
| uint GWG.UsoUIElements.Utilities.SerializableGuid.Part1 |
The first 32-bit portion of the GUID data.
This field stores bytes 0-3 of the GUID as a 32-bit unsigned integer. It is serialized by Unity but hidden in the Inspector for cleaner display.
| uint GWG.UsoUIElements.Utilities.SerializableGuid.Part2 |
The second 32-bit portion of the GUID data.
This field stores bytes 4-7 of the GUID as a 32-bit unsigned integer. It is serialized by Unity but hidden in the Inspector for cleaner display.
| uint GWG.UsoUIElements.Utilities.SerializableGuid.Part3 |
The third 32-bit portion of the GUID data.
This field stores bytes 8-11 of the GUID as a 32-bit unsigned integer. It is serialized by Unity but hidden in the Inspector for cleaner display.
| uint GWG.UsoUIElements.Utilities.SerializableGuid.Part4 |
The fourth 32-bit portion of the GUID data.
This field stores bytes 12-15 of the GUID as a 32-bit unsigned integer. It is serialized by Unity but hidden in the Inspector for cleaner display.
|
staticget |
Gets a SerializableGuid instance that represents an empty GUID (all zeros). This is equivalent to System.Guid.Empty but for the serializable version.
A SerializableGuid with all parts set to zero, representing an empty/null GUID.
This static property provides a standardized way to represent empty or uninitialized GUIDs. It's commonly used for default values, null checks, and initialization scenarios. The empty GUID has the hexadecimal representation of "00000000000000000000000000000000".