Version: Unity 6.6 Alpha (6000.6)
LanguageEnglish
  • C#

UniqueStyleString.TryGet

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

Declaration

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

Parameters

Parameter Description
value The string value that the resulting UniqueStyleString needs to represent
result A UniqueStyleString that matches the provided value, if any

Returns

bool True if a UniqueStyleString representing the provided value currently exists

Description

Attempts to retrieve an existing UniqueStyleString from a string value.

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.