---
title: "setValue(_:forButtonElement:)"
framework: gamecontroller
role: symbol
role_heading: Instance Method
path: "gamecontroller/gcvirtualcontroller/setvalue(_:forbuttonelement:)"
---

# setValue(_:forButtonElement:)

Changes the value of a button element in the virtual controller.

## Declaration

```swift
func setValue(_ value: CGFloat, forButtonElement element: String)
```

## Parameters

- `value`: A value in the range [-1.0, 1.0].
- `element`: The name of the button element to update.

## Discussion

Discussion Use this method to update the value of a button element in the virtual controller when you set the isHidden property to true and present your own virtual controller interface.

## See Also

### Presenting a custom interface

- [setPosition(_:forDirectionPadElement:)](gamecontroller/gcvirtualcontroller/setposition(_:fordirectionpadelement:).md)
