Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


EffectiveSizeOf<T>(ref T)

Returns the effective size in bytes of this string.
Read time 1 minuteLast updated 6 days ago

Definition

  • Type: Method
  • Namespace: Unity.Collections
  • Assembly: UnityEngine.ManagedKernelModule

EffectiveSizeOf<T>(T)

public static int EffectiveSizeOf<T>(this ref T fs) where T : unmanaged, INativeList<byte>, IUTF8Bytes

Parameters

fs

T
A string to get the effective size of.

Returns

Type

Description

intThe effective size in bytes of this string.

Remarks

"Effective size" is
Length + 3
, the number of bytes you need to copy when serializing the string. (The plus 3 accounts for the null-terminator byte and the 2 bytes that store the Length).
Useful for checking whether this string will fit in the space of a smaller string.