# TryGetProperty

> Gets an IProperty on the specified container for the given PropertyPath.

## Definition

* **Type:** Method
* **Namespace:** [Unity.Properties](/engine/6000.7/script-reference/unity/properties.md)
* **Assembly:** UnityEngine.PropertiesModule

## TryGetProperty\<T>(T, PropertyPath, IProperty)

Gets an [IProperty](/engine/6000.7/script-reference/unity/properties/iproperty.md) on the specified container for the given [PropertyPath](/engine/6000.7/script-reference/unity/properties/propertypath.md).

```csharp
public static bool TryGetProperty<TContainer>(TContainer container, in PropertyPath path, out IProperty property)
```

### Parameters

**** (T): The container tree to search.**** (\[PropertyPath]\(/engine/6000.7/script-reference/unity/properties/propertypath)): The property path to resolve.**** (\[IProperty]\(/engine/6000.7/script-reference/unity/properties/iproperty)): When this method returns, contains the property associated with the specified path, if the property is found; otherwise, null.

### Returns

| Type                                                          | Description                                                                 |
| ------------------------------------------------------------- | --------------------------------------------------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | `true` if the property was found at the specified path; otherwise, `false`. |

### Remarks

While the container data is not actually read from or written to. The container itself is needed to resolve polymorphic fields and list elements.

## TryGetProperty\<T>(T, PropertyPath, IProperty)

Gets an [IProperty](/engine/6000.7/script-reference/unity/properties/iproperty.md) on the specified container for the given [PropertyPath](/engine/6000.7/script-reference/unity/properties/propertypath.md).

```csharp
public static bool TryGetProperty<TContainer>(ref TContainer container, in PropertyPath path, out IProperty property)
```

### Parameters

**** (T): The container tree to search.**** (\[PropertyPath]\(/engine/6000.7/script-reference/unity/properties/propertypath)): The property path to resolve.**** (\[IProperty]\(/engine/6000.7/script-reference/unity/properties/iproperty)): When this method returns, contains the property associated with the specified path, if the property is found; otherwise, null.

### Returns

| Type                                                          | Description                                                                 |
| ------------------------------------------------------------- | --------------------------------------------------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | `true` if the property was found at the specified path; otherwise, `false`. |

### Remarks

While the container data is not actually read from or written to. The container itself is needed to resolve polymorphic fields and list elements.

## TryGetProperty\<T>(T, PropertyPath, IProperty, VisitReturnCode)

Gets an [IProperty](/engine/6000.7/script-reference/unity/properties/iproperty.md) on the specified container for the given [PropertyPath](/engine/6000.7/script-reference/unity/properties/propertypath.md).

```csharp
public static bool TryGetProperty<TContainer>(ref TContainer container, in PropertyPath path, out IProperty property, out VisitReturnCode returnCode)
```

### Parameters

**** (T): The container tree to search.**** (\[PropertyPath]\(/engine/6000.7/script-reference/unity/properties/propertypath)): The property path to resolve.**** (\[IProperty]\(/engine/6000.7/script-reference/unity/properties/iproperty)): When this method returns, contains the property associated with the specified path, if the property is found; otherwise, null.**** (\[VisitReturnCode]\(/engine/6000.7/script-reference/unity/properties/visitreturncode)): When this method returns, contains the return code.

### Returns

| Type                                                          | Description                                                                 |
| ------------------------------------------------------------- | --------------------------------------------------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | `true` if the property was found at the specified path; otherwise, `false`. |

### Remarks

While the container data is not actually read from or written to. The container itself is needed to resolve polymorphic fields and list elements.
