Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


TrySetValue<T>(T)

Sets a new value to the port's UI field.
Read time 1 minuteLast updated 7 days ago

Definition

bool TrySetValue<T>(T value)

Parameters

value

T
The value to assign to the port’s UI field.

Returns

Type

Description

bool
true
if the value was successfully set; otherwise,
false
.

Remarks

This method is intended for editor-time edition of an input port’s value, configured through a field displayed in the UI. If the port is connected, the field is hidden and no value is available, so the method returns
false
. It also performs a type check and conversion internally. If the value cannot be cast to IPort.DataType, the method returns
false
.