# TryAccept

> Tries to visit the specified container by ref using the specified visitor.

## Definition

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

## TryAccept\<T>(IPropertyBagVisitor, T, VisitParameters)

Tries to visit the specified `container` by ref using the specified `visitor`.

```csharp
public static bool TryAccept<TContainer>(IPropertyBagVisitor visitor, ref TContainer container, VisitParameters parameters = default)
```

### Parameters

**** (\[IPropertyBagVisitor]\(/engine/6000.6/script-reference/unity/properties/ipropertybagvisitor)): The visitor.**** (T): The container to visit.**** (\[VisitParameters]\(/engine/6000.6/script-reference/unity/properties/visitparameters)): The visit parameters to use.

### Returns

| Type                                                          | Description                                            |
| ------------------------------------------------------------- | ------------------------------------------------------ |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | `true` if the visitation succeeded; `false` otherwise. |

## TryAccept\<T>(IPropertyBagVisitor, T, VisitReturnCode, VisitParameters)

Tries to visit the specified `container` by ref using the specified `visitor`.

```csharp
public static bool TryAccept<TContainer>(IPropertyBagVisitor visitor, ref TContainer container, out VisitReturnCode returnCode, VisitParameters parameters = default)
```

### Parameters

**** (\[IPropertyBagVisitor]\(/engine/6000.6/script-reference/unity/properties/ipropertybagvisitor)): The visitor.**** (T): The container to visit.**** (\[VisitReturnCode]\(/engine/6000.6/script-reference/unity/properties/visitreturncode)): When this method returns, contains the return code.**** (\[VisitParameters]\(/engine/6000.6/script-reference/unity/properties/visitparameters)): The visit parameters to use.

### Returns

| Type                                                          | Description                                            |
| ------------------------------------------------------------- | ------------------------------------------------------ |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | `true` if the visitation succeeded; `false` otherwise. |

## TryAccept\<T>(IPropertyVisitor, T, PropertyPath, VisitReturnCode, VisitParameters)

Visit the specified `container` using the specified `visitor` at the given [PropertyPath](/engine/6000.6/script-reference/unity/properties/propertypath.md).

```csharp
public static bool TryAccept<TContainer>(IPropertyVisitor visitor, ref TContainer container, in PropertyPath path, out VisitReturnCode returnCode, VisitParameters parameters = default)
```

### Parameters

**** (\[IPropertyVisitor]\(/engine/6000.6/script-reference/unity/properties/ipropertyvisitor)): The visitor.**** (T): The container to visit.**** (\[PropertyPath]\(/engine/6000.6/script-reference/unity/properties/propertypath)): The property path to visit.**** (\[VisitReturnCode]\(/engine/6000.6/script-reference/unity/properties/visitreturncode)): When this method returns, contains the return code.**** (\[VisitParameters]\(/engine/6000.6/script-reference/unity/properties/visitparameters)): The visit parameters to use.

### Returns

| Type                                                          | Description |
| ------------------------------------------------------------- | ----------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) |             |
