# Change Component Properties at Runtime

## Set Properties with Getter/Setter

You can easily change component properties at runtime as most of these properties are writable in blueprint. You can access properties by using the *Get* and *Set* nodes from the component you want to modify.

Here is an example. When the character overlaps with a trigger box at the specified place, the camera distance will smoothly increases to 600.

<figure><img src="https://1253177398-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIc7aRtmwmEkkqEJZORmC%2Fuploads%2FVYmuHONrOCBBdIjy3eX9%2Fchangedistance.gif?alt=media&#x26;token=5e6460bb-b6f2-4331-8411-5026eed8bba1" alt=""><figcaption></figcaption></figure>

The blueprint is quite simple. First call the *GetActiveCamera* node and check its validity. Then get its follow component and cast it to *ScreenFollow*. Last use a *Timeline* node to interpolate from the default camera distance to the target camera distance.

<figure><img src="https://1253177398-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIc7aRtmwmEkkqEJZORmC%2Fuploads%2F4C6yPFC3n8FqdxBFKYlb%2F2.png?alt=media&#x26;token=3a2cef29-af00-4b94-a34d-4b90b07dfde6" alt=""><figcaption></figcaption></figure>

You can define various custom functions and place them in a library. It will be very convenient next time you use these functions.

## Set Properties with SetPropertyByName Node

V0.2.1 added a new blueprint node SetPropertyByName, which allows you to set any numeric/struct type property of any object in an **async** manner. It supports nested properties, that is, you can use PropertyName\_A.PropertyName\_B.PropertyName\_C to access and set proerties. Reference the [node list](https://sulleyyys-organization.gitbook.io/manuals-of-ccs/blueprint-nodes-list/ecameralibrary#setpropertybyname) for a more comprehensive introduction to the node itself.

In the following example, let us use this node to modify `ScreenFollow` component's `CameraDistance` property.

1. Create a new camera class with the `ScreenFollow` component. It's named `ThirdPersonCamera` here.

<figure><img src="https://1253177398-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIc7aRtmwmEkkqEJZORmC%2Fuploads%2Flysa2gNW6HfLaPNiBUve%2Fimage.png?alt=media&#x26;token=082bca02-4ea0-49b8-a331-a83f03bc2be5" alt=""><figcaption></figcaption></figure>

2. Call this camera in blueprint and use the `SetPropertyByName` node to set the `CameraDistance` property in the `ScreenFollow` component. Here the destination value is 1000 and blend duration is 5 seconds.

<figure><img src="https://1253177398-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIc7aRtmwmEkkqEJZORmC%2Fuploads%2FCMrIXKTRaNAw7oSO26BU%2Fimage.png?alt=media&#x26;token=743c1523-164a-4d74-bc23-b5f5318b6ea1" alt=""><figcaption></figcaption></figure>

3. Run the game and you will see the camera distance changes as expected.

<figure><img src="https://1253177398-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIc7aRtmwmEkkqEJZORmC%2Fuploads%2FWRZx8Y3WvIuG7qN6xRHs%2Fgif-ezgif.com-optimize.gif?alt=media&#x26;token=ae38e0e2-93c8-4977-8d35-1794e4419f24" alt=""><figcaption></figcaption></figure>

4. As property names can be nested, you can achieve this same purpose using one of the following three ways.

<figure><img src="https://1253177398-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIc7aRtmwmEkkqEJZORmC%2Fuploads%2FYCCW8zLflTBcL7rAt1tv%2Fimage.png?alt=media&#x26;token=c6f8b0d2-38e6-4f38-8dd1-9cb0bd830643" alt=""><figcaption></figcaption></figure>
