Struct SerializableGUID
A serializable version of Unity
Implements
Inherited Members
Namespace: Unity.Behavior.GraphFramework
Assembly: SerializableGUID.dll
Syntax
[Serializable]
public struct SerializableGUID : IEquatable<SerializableGUID>
Remarks
This implementation is using a Hash128 backing. The binary representation is the same as the
Unity
Constructors
SerializableGUID(string)
Initializes a new SerializableGUID from a string.
Declaration
public SerializableGUID(string hashString)
Parameters
Type | Name | Description |
---|---|---|
string | hashString | The string used to initialize the SerializableGUID. |
Remarks
The string passed in must be parsable by Parse(string).
SerializableGUID(ulong, ulong)
Initializes a new SerializableGUID from a pair of ulongs.
Declaration
public SerializableGUID(ulong a, ulong b)
Parameters
SerializableGUID(Hash128)
Initializes a new SerializableGUID from a Hash128.
Declaration
public SerializableGUID(Hash128 hash)
Parameters
Type | Name | Description |
---|---|---|
Hash128 | hash | The hash used to initialize the SerializableGUID. |
Properties
Valid
Whether or not the SerializableGUID is valid.
Declaration
public bool Valid { get; }
Property Value
Type | Description |
---|---|
bool |
Methods
Equals(object)
Determines whether a SerializableGUIDs is equal to a given object.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
object | obj | The object to compare with the current SerializableGUID. |
Returns
Type | Description |
---|---|
bool | True if the specified object is equal to the current SerializableGUID; otherwise, false. |
Overrides
Equals(SerializableGUID)
Determines whether two SerializableGUIDs are equal.
Declaration
public bool Equals(SerializableGUID other)
Parameters
Type | Name | Description |
---|---|---|
Serializable |
other | The SerializableGUID to compare with the current one. |
Returns
Type | Description |
---|---|
bool | True if the specified SerializableGUID is equal to the current one; otherwise, false. |
Generate()
Generates a new SerializableGUID.
Declaration
public static SerializableGUID Generate()
Returns
Type | Description |
---|---|
Serializable |
A new SerializableGUID. |
Remarks
When called from editor code, the method will use GUID.Generate() to generate
the GUID. When called from the runtime, it will use New
GetHashCode()
Get a hash code for the SerializableGUID.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
int | A hash code for the GUID. |
Overrides
ToParts()
Get the pair of ulong representing the SerializableGUID.
Declaration
public (ulong, ulong) ToParts()
Returns
Type | Description |
---|---|
(ulong, ulong) | A tuple containing the pair of ulong representing the SerializableGUID. |
ToString()
Returns a string representation of the SerializableGUID.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string | A string that represents the SerializableGUID. |
Overrides
Operators
operator ==(SerializableGUID, SerializableGUID)
Determines whether two SerializableGUIDs are equal.
Declaration
public static bool operator ==(SerializableGUID left, SerializableGUID right)
Parameters
Type | Name | Description |
---|---|---|
Serializable |
left | The left SerializableGUID to compare. |
Serializable |
right | The right SerializableGUID to compare. |
Returns
Type | Description |
---|---|
bool | True if both specified SerializableGUIDs are equal; otherwise, false. |
implicit operator Hash128(SerializableGUID)
Cast a SerializedGUID as a Hash128.
Declaration
public static implicit operator Hash128(SerializableGUID sGuid)
Parameters
Type | Name | Description |
---|---|---|
Serializable |
sGuid | The SerializedGUID to cast. |
Returns
Type | Description |
---|---|
Hash128 | The cast value. |
implicit operator SerializableGUID(Hash128)
Cast a Hash128 as a SerializedGUID.
Declaration
public static implicit operator SerializableGUID(Hash128 hash)
Parameters
Returns
Type | Description |
---|---|
Serializable |
The cast value. |
operator !=(SerializableGUID, SerializableGUID)
Determines whether two SerializableGUIDs are not equal.
Declaration
public static bool operator !=(SerializableGUID left, SerializableGUID right)
Parameters
Type | Name | Description |
---|---|---|
Serializable |
left | The left SerializableGUID to compare. |
Serializable |
right | The right SerializableGUID to compare. |
Returns
Type | Description |
---|---|
bool | True if the specified SerializableGUIDs are not equal; otherwise, false. |