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

PortReference.TryGetPreview

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 bool TryGetPreview(out string displayValue);

Parameters

Parameter Description
displayValue When this method returns true, contains the string value of the port preview; otherwise, null.

Returns

bool true if the port preview value was successfully retrieved; otherwise, false.

Description

Retrieves the current string value assigned to the port preview for a given port.

If no port preview is currently set for the given port, this method returns false and is null. Call PortReference.SetPreview to assign a display value to a port preview before querying it. Throws ObjectDisposedException when you access this method after you call Context.Dispose on the context.

 if (context.GetPortReference(portID).TryGetPreview(out var displayValue))
     Debug.Log(displayValue);