Append
Hash new input string and combine with the current hash value.
Read time 4 minutesLast updated 6 days ago
Definition
- Type: Method
- Namespace: UnityEngine
- Assembly: UnityEngine.CoreModule
Append(string)
Hash new input string and combine with the current hash value.
public void Append(string data)
Parameters
Input data string. Note that Unity interprets the string as UTF-8 data, even if internally in C# strings are UTF-16.
Append<T>(NativeArray<T>)
Hash new input data array and combine with the current hash value.
public void Append<T>(NativeArray<T> data) where T : struct
Parameters
Input data array.
Append<T>(NativeArray<T>, int, int)
Hash a slice of new input data array and combine with the current hash value.
public void Append<T>(NativeArray<T> data, int start, int count) where T : struct
Parameters
Input data array.
The first element in the data to start hashing from.
Number of array elements to hash.
Append<T>(`<>[])
Hash new input data array and combine with the current hash value.
public void Append<T>(T[] data) where T : struct
Parameters
Input data array.
Append<T>(`<>[], int, int)
Hash a slice of new input data array and combine with the current hash value.
public void Append<T>(T[] data, int start, int count) where T : struct
Parameters
Append<T>(List<T>)
Hash new input data array and combine with the current hash value.
public void Append<T>(List<T> data) where T : struct
Parameters
Input data array.
Append<T>(List<T>, int, int)
Hash a slice of new input data array and combine with the current hash value.
public void Append<T>(List<T> data, int start, int count) where T : struct
Parameters
Append<T>(T)
Hash new input data and combine with the current hash value.
public void Append<T>(ref T val) where T : unmanaged
Parameters
Remarks
The value must be an "unmanaged" C# type. Primitive types like int, float, bool, enums, pointers, or structs containing primitive types are all unmanaged types. See Unmanaged types in C# language reference.
The int and float overloads use a dedicated code path that is optimized for 4-byte data sizes.
Examples
using UnityEngine;public class ExampleScript : MonoBehaviour{ void Start() { var hash = new Hash128(); hash.Append(42); hash.Append(13.0f); hash.Append("Hello"); hash.Append(new int[] {1, 2, 3, 4, 5}); // prints "2d6e582c3fcfb4b8f3c16650a75dc37b" Debug.Log(hash.ToString()); }}
Append(int)
Hash new input data and combine with the current hash value.
public void Append(int val)
Parameters
Input value.
Remarks
The value must be an "unmanaged" C# type. Primitive types like int, float, bool, enums, pointers, or structs containing primitive types are all unmanaged types. See Unmanaged types in C# language reference.
The int and float overloads use a dedicated code path that is optimized for 4-byte data sizes.
Examples
using UnityEngine;public class ExampleScript : MonoBehaviour{ void Start() { var hash = new Hash128(); hash.Append(42); hash.Append(13.0f); hash.Append("Hello"); hash.Append(new int[] {1, 2, 3, 4, 5}); // prints "2d6e582c3fcfb4b8f3c16650a75dc37b" Debug.Log(hash.ToString()); }}
Append(float)
Hash new input data and combine with the current hash value.
public void Append(float val)
Parameters
Input value.
Remarks
The value must be an "unmanaged" C# type. Primitive types like int, float, bool, enums, pointers, or structs containing primitive types are all unmanaged types. See Unmanaged types in C# language reference.
The int and float overloads use a dedicated code path that is optimized for 4-byte data sizes.
Examples
using UnityEngine;public class ExampleScript : MonoBehaviour{ void Start() { var hash = new Hash128(); hash.Append(42); hash.Append(13.0f); hash.Append("Hello"); hash.Append(new int[] {1, 2, 3, 4, 5}); // prints "2d6e582c3fcfb4b8f3c16650a75dc37b" Debug.Log(hash.ToString()); }}
Append(void*, ulong)
Hash new input data and combine with the current hash value.
public void Append(void* data, ulong size)