Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


TryGetPreview(out string)

Retrieves the current string value assigned to the port preview for a given port.
Read time 1 minuteLast updated 8 days ago

Definition

TryGetPreview(string)

public bool TryGetPreview(out string displayValue)

Parameters

displayValue

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

Returns

Type

Description

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

Remarks

If no port preview is currently set for the given port, this method returns false and
displayValue
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.

Examples

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