Version: Unity 6.7 Beta (6000.7)
LanguageEnglish
  • C#

NativeText

struct in Unity.Collections


Implements interfaces:IIndexable<T0>, INativeDisposable, INativeList<T0>, IUTF8Bytes

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Description

An unmanaged, mutable, resizable UTF-8 string.

The string is always null-terminated, meaning a zero byte always immediately follows the last character.

Static Properties

Property Description
MaxCapacity The maximum number of elements this type of container can hold.

Properties

Property Description
Capacity The current capacity in bytes of this string.
IsCreated Whether this string's character buffer has been allocated (and not yet deallocated).
IsEmpty Whether this string has no characters.
Length The current length in bytes of this string.
this[int] The byte at an index. Note that writing to a NativeText.Readonly is not supported; the setter of this property throws when safety checks are enabled.
Value A copy of this string as a managed string.

Constructors

Constructor Description
NativeText Initializes and returns an instance of NativeText with the characters copied from another string.

Public Methods

Method Description
Add Appends a byte.
AsReadOnly Returns a readonly version of this NativeText instance.
Clear Sets the length to 0.
CompareTo Returns the lexicographical sort order of this string relative to another.
Dispose Releases all resources (memory and safety handles).
ElementAt Returns a reference to the byte (not character) at an index.
Equals Returns true if this string and another are equal.
GetEnumerator Returns an enumerator for iterating over the characters of the NativeText.
GetHashCode Returns a hash code of this string.
GetUnsafePtr Returns a pointer to this string's character buffer.
ToString Returns a managed string copy of this string.
TryResize Attempt to set the length in bytes of this string.

Operators

Operator Description
operator != Returns true if two strings are unequal.
operator == Returns true if two strings are equal.