Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


TryGet(string, out UniqueStyleString)

Attempts to retrieve an existing UniqueStyleString from a string value.
Read time 1 minuteLast updated 17 days ago

Definition

TryGet(string, UniqueStyleString)

public static bool TryGet(string value, out UniqueStyleString result)

Parameters

value

The string value that the resulting UniqueStyleString needs to represent

A UniqueStyleString that matches the provided value, if any

Returns

Type

Description

boolTrue if a UniqueStyleString representing the provided value currently exists

Remarks

Methods such as VisualElement.AddToClassList guarantee that the UniqueStyleString exists after the call. If
TryGet
returns false for a given value, then there is no need to call VisualElement.ClassListContains for that same value, as it will necessarily return false. Similarly, there is no need to call VisualElement.RemoveFromClassList for that value.