# GetValueFromBag(IUxmlAttributes, CreationContext)

> Method that retrieves an attribute's value from an attribute bag. Returns it if it is found, otherwise return defaultValue.

## Definition

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

> **Warning:**
>
> **Deprecated.** UxmlTraits system is deprecated and will be removed. Use UxmlElementAttribute instead.

```csharp
public override Type GetValueFromBag(IUxmlAttributes bag, CreationContext cc)
```

### Parameters

**** (\[IUxmlAttributes]\(/engine/6000.5/script-reference/unityengine/uielements/iuxmlattributes)): The attribute bag.**** (\[CreationContext]\(/engine/6000.5/script-reference/unityengine/uielements/creationcontext)): The context in which the method retrieves attribute values.

### Returns

| Type                                                       | Description                                                                       |
| ---------------------------------------------------------- | --------------------------------------------------------------------------------- |
| [Type](https://learn.microsoft.com/dotnet/api/system.type) | The attribute's value. If the method cannot find the value, returns defaultValue. |
