# 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="/files/4jBcJjiZjR1wf9TauHLI" 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="/files/gpCeaE5qrFeXiID4eXJ3" 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](/manuals-of-ccs/blueprint-nodes-list/ecameralibrary.md#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="/files/LmH1I3W2wdUIvgWWlXya" 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="/files/tRLzYmlSN1O1bw5rkpjK" alt=""><figcaption></figcaption></figure>

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

<figure><img src="/files/w1DBnUkRdgMzwcQJjk00" 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="/files/AS3uz6MLb1FVef54FVTO" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://sulleyyys-organization.gitbook.io/manuals-of-ccs/advanced-uses/change-component-properties-at-runtime.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
