# TryGetValue

> Gets the value associated with the specified CustomStyleProperty<T>.

## Definition

* **Type:** Method
* **Namespace:** [UnityEngine.UIElements](/engine/6000.0/script-reference/unityengine/uielements.md)
* **Assembly:** UnityEngine.UIElementsModule

## TryGetValue(CustomStyleProperty\<float>, float)

Gets the value associated with the specified [CustomStyleProperty\<T>](/engine/6000.0/script-reference/unityengine/uielements/customstyleproperty1.md).

```csharp
bool TryGetValue(CustomStyleProperty<float> property, out float value)
```

### Parameters

**** (\[CustomStyleProperty\<float>]\(/engine/6000.0/script-reference/unityengine/uielements/customstyleproperty1)): **** (\[float]\(https\://learn.microsoft.com/dotnet/api/system.single)):&#x20;

### Returns

| Type                                                          | Description                                  |
| ------------------------------------------------------------- | -------------------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | True if the property is found, false if not. |

## TryGetValue(CustomStyleProperty\<int>, int)

Gets the value associated with the specified [CustomStyleProperty\<T>](/engine/6000.0/script-reference/unityengine/uielements/customstyleproperty1.md).

```csharp
bool TryGetValue(CustomStyleProperty<int> property, out int value)
```

### Parameters

**** (\[CustomStyleProperty\<int>]\(/engine/6000.0/script-reference/unityengine/uielements/customstyleproperty1)): **** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)):&#x20;

### Returns

| Type                                                          | Description                                  |
| ------------------------------------------------------------- | -------------------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | True if the property is found, false if not. |

## TryGetValue(CustomStyleProperty\<bool>, bool)

Gets the value associated with the specified [CustomStyleProperty\<T>](/engine/6000.0/script-reference/unityengine/uielements/customstyleproperty1.md).

```csharp
bool TryGetValue(CustomStyleProperty<bool> property, out bool value)
```

### Parameters

**** (\[CustomStyleProperty\<bool>]\(/engine/6000.0/script-reference/unityengine/uielements/customstyleproperty1)): **** (\[bool]\(https\://learn.microsoft.com/dotnet/api/system.boolean)):&#x20;

### Returns

| Type                                                          | Description                                  |
| ------------------------------------------------------------- | -------------------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | True if the property is found, false if not. |

## TryGetValue(CustomStyleProperty\<Color>, Color)

Gets the value associated with the specified [CustomStyleProperty\<T>](/engine/6000.0/script-reference/unityengine/uielements/customstyleproperty1.md).

```csharp
bool TryGetValue(CustomStyleProperty<Color> property, out Color value)
```

### Parameters

**** (\[CustomStyleProperty\<Color>]\(/engine/6000.0/script-reference/unityengine/uielements/customstyleproperty1)): **** (\[Color]\(/engine/6000.0/script-reference/unityengine/color)):&#x20;

### Returns

| Type                                                          | Description                                  |
| ------------------------------------------------------------- | -------------------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | True if the property is found, false if not. |

## TryGetValue(CustomStyleProperty\<Texture2D>, Texture2D)

Gets the value associated with the specified [CustomStyleProperty\<T>](/engine/6000.0/script-reference/unityengine/uielements/customstyleproperty1.md).

```csharp
bool TryGetValue(CustomStyleProperty<Texture2D> property, out Texture2D value)
```

### Parameters

**** (\[CustomStyleProperty\<Texture2D>]\(/engine/6000.0/script-reference/unityengine/uielements/customstyleproperty1)): **** (\[Texture2D]\(/engine/6000.0/script-reference/unityengine/texture2d)):&#x20;

### Returns

| Type                                                          | Description                                  |
| ------------------------------------------------------------- | -------------------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | True if the property is found, false if not. |

## TryGetValue(CustomStyleProperty\<Sprite>, Sprite)

Gets the value associated with the specified [CustomStyleProperty\<T>](/engine/6000.0/script-reference/unityengine/uielements/customstyleproperty1.md).

```csharp
bool TryGetValue(CustomStyleProperty<Sprite> property, out Sprite value)
```

### Parameters

**** (\[CustomStyleProperty\<Sprite>]\(/engine/6000.0/script-reference/unityengine/uielements/customstyleproperty1)): **** (\[Sprite]\(/engine/6000.0/script-reference/unityengine/sprite)):&#x20;

### Returns

| Type                                                          | Description                                  |
| ------------------------------------------------------------- | -------------------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | True if the property is found, false if not. |

## TryGetValue(CustomStyleProperty\<VectorImage>, VectorImage)

Gets the value associated with the specified [CustomStyleProperty\<T>](/engine/6000.0/script-reference/unityengine/uielements/customstyleproperty1.md).

```csharp
bool TryGetValue(CustomStyleProperty<VectorImage> property, out VectorImage value)
```

### Parameters

**** (\[CustomStyleProperty\<VectorImage>]\(/engine/6000.0/script-reference/unityengine/uielements/customstyleproperty1)): **** (\[VectorImage]\(/engine/6000.0/script-reference/unityengine/uielements/vectorimage)):&#x20;

### Returns

| Type                                                          | Description                                  |
| ------------------------------------------------------------- | -------------------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | True if the property is found, false if not. |

## TryGetValue\<T>(CustomStyleProperty\<T>, T)

Gets the value associated with the specified [CustomStyleProperty\<T>](/engine/6000.0/script-reference/unityengine/uielements/customstyleproperty1.md).

```csharp
bool TryGetValue<T>(CustomStyleProperty<T> property, out T value) where T : Object
```

### Parameters

**** (\[CustomStyleProperty\<T>]\(/engine/6000.0/script-reference/unityengine/uielements/customstyleproperty1)): **** (T):&#x20;

### Returns

| Type                                                          | Description                                  |
| ------------------------------------------------------------- | -------------------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | True if the property is found, false if not. |

## TryGetValue(CustomStyleProperty\<string>, string)

Gets the value associated with the specified [CustomStyleProperty\<T>](/engine/6000.0/script-reference/unityengine/uielements/customstyleproperty1.md).

```csharp
bool TryGetValue(CustomStyleProperty<string> property, out string value)
```

### Parameters

**** (\[CustomStyleProperty\<string>]\(/engine/6000.0/script-reference/unityengine/uielements/customstyleproperty1)): **** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)):&#x20;

### Returns

| Type                                                          | Description                                  |
| ------------------------------------------------------------- | -------------------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | True if the property is found, false if not. |
