Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


TrySetValue

Tries to set the value of a property at the given path to the given value.
Read time 2 minutesLast updated 6 days ago

Definition

  • Type: Method
  • Namespace: Unity.Properties
  • Assembly: UnityEngine.PropertiesModule

TrySetValue<T, U>(T, string, T)

Tries to set the value of a property at the given path to the given value.
public static bool TrySetValue<TContainer, TValue>(TContainer container, string name, TValue value)

Parameters

container

T
The container whose property will be set.

name

The name of the property to set.

value

T
The value to assign to the property.

Returns

Type

Description

bool
true
if the value was set correctly;
false
otherwise.

Remarks

This method is NOT thread safe.

TrySetValue<T, U>(T, string, T)

Tries to set the value of a property at the given path to the given value.
public static bool TrySetValue<TContainer, TValue>(ref TContainer container, string name, TValue value)

Parameters

container

T
The container whose property will be set.

name

The name of the property to set.

value

T
The value to assign to the property.

Returns

Type

Description

bool
true
if the value was set correctly;
false
otherwise.

Remarks

This method is NOT thread safe.

TrySetValue<T, U>(T, PropertyPath, T)

Tries to set the value of a property at the given path to the given value.
public static bool TrySetValue<TContainer, TValue>(TContainer container, in PropertyPath path, TValue value)

Parameters

container

T
The container whose property will be set.

The path of the property to set.

value

T
The value to assign to the property.

Returns

Type

Description

bool
true
if the value was set correctly;
false
otherwise.

Remarks

This method is NOT thread safe.

TrySetValue<T, U>(T, PropertyPath, T)

Tries to set the value of a property at the given path to the given value.
public static bool TrySetValue<TContainer, TValue>(ref TContainer container, in PropertyPath path, TValue value)

Parameters

container

T
The container whose property will be set.

The path of the property to set.

value

T
The value to assign to the property.

Returns

Type

Description

bool
true
if the value was set correctly;
false
otherwise.

Remarks

This method is NOT thread safe.

TrySetValue<T, U>(T, PropertyPath, T, VisitReturnCode)

Tries to set the value of a property at the given path to the given value.
public static bool TrySetValue<TContainer, TValue>(ref TContainer container, in PropertyPath path, TValue value, out VisitReturnCode returnCode)

Parameters

container

T
The container whose property will be set.

The path of the property to set.

value

T
The value to assign to the property.

returnCode

When this method returns, contains the return code.

Returns

Type

Description

bool
true
if the value was set correctly;
false
otherwise.

Remarks

This method is NOT thread safe.