docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Struct SerializableGUID

    A serializable version of UnityEditor.GUID.

    Implements
    IEquatable<SerializableGUID>
    Inherited Members
    object.Equals(object, object)
    object.GetType()
    object.ReferenceEquals(object, object)
    Namespace: Graph
    Assembly: Unity.MuseLab.Graph.dll
    Syntax
    [JsonObject(IsReference = false)]
    [Serializable]
    public struct SerializableGUID : IEquatable<SerializableGUID>
    Remarks

    This implementation is using a Hash128 backing. The binary representation is the same as the UnityEditor.GUID one, but the string version differs.

    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
    Type Name Description
    ulong a

    The first part of the GUID.

    ulong b

    The second part of the GUID.

    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
    [JsonIgnore]
    public bool Valid { get; }
    Property Value
    Type Description
    bool

    Methods

    Equals(SerializableGUID)

    Determines whether two SerializableGUIDs are equal.

    Declaration
    public bool Equals(SerializableGUID other)
    Parameters
    Type Name Description
    SerializableGUID 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.

    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
    ValueType.Equals(object)

    Generate()

    Generates a new SerializableGUID.

    Declaration
    public static SerializableGUID Generate()
    Returns
    Type Description
    SerializableGUID

    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 NewGuid().

    GetHashCode()

    Get a hash code for the SerializableGUID.

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    int

    A hash code for the GUID.

    Overrides
    ValueType.GetHashCode()

    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
    ValueType.ToString()

    Operators

    operator ==(SerializableGUID, SerializableGUID)

    Determines whether two SerializableGUIDs are equal.

    Declaration
    public static bool operator ==(SerializableGUID left, SerializableGUID right)
    Parameters
    Type Name Description
    SerializableGUID left

    The left SerializableGUID to compare.

    SerializableGUID 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
    SerializableGUID 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
    Type Name Description
    Hash128 hash

    The Hash128 to cast.

    Returns
    Type Description
    SerializableGUID

    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
    SerializableGUID left

    The left SerializableGUID to compare.

    SerializableGUID right

    The right SerializableGUID to compare.

    Returns
    Type Description
    bool

    True if the specified SerializableGUIDs are not equal; otherwise, false.

    Implements

    IEquatable<T>
    In This Article
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)