Documentation

Unity Engine

Download Unity

Unity Engine

implicit operator StringHash

Converts a string into its hash, so that you can pass a string where a StringHash is expected.
Read time 1 minuteLast updated 4 hours ago

Definition

implicit operator StringHash(StringHas)

Converts a string into its hash, so that you can pass a string where a StringHash is expected.
[ExcludeFromBurstCompatTesting("Takes managed string")]public static implicit operator StringHash(string str)

Parameters

The string to hash, such as a transform path or a property name.

Returns

Type

Description

StringHashThe hash of the string. The hash is 0 if the string is null or empty.

Remarks

The conversion calls StringHash, so a null or empty string gives a hash of 0. Use it to pass a string where a
StringHash
is expected, for example
FindBoneIndex("Hips/Spine")
.

implicit operator StringHash(StringHas)

Converts a
uint
into a
StringHash
.
public static implicit operator StringHash(uint id)

Parameters

The raw hash value to wrap. It becomes StringHash.Id.

Returns

Type

Description

StringHashA StringHash whose StringHash.Id is
id
.

implicit operator StringHash(StringHas)

Implicitly converts a GenericBinding to a StringHash.
[ExcludeFromBurstCompatTesting("Resolves the script on the main thread")]public static implicit operator StringHash(GenericBinding binding)

Parameters

The GenericBinding to convert.

Returns

Type

Description

StringHashReturns a unique StringHash value for this GenericBinding.

Remarks

The hash is the same in every session, so you can serialize it. For a MonoBehaviour property, the hash includes the assembly name and full class name of the script, so renaming the script class changes it.