---
title: Create a simple slider Rule
product: SpeedTree Modeler
version: '10'
latest_version: '10'
status: This page documents version 10. The latest version is 10.
canonical: https://docs.unity.com/en-us/speedtree-modeler/10/rules-create-slider
latest_url: https://docs.unity.com/en-us/speedtree-modeler/10/rules-create-slider.md
last_updated: 2026-11-19
generated_at: 2026-11-19T15:05:45.008Z
locale: en-us
---

# Create a simple slider Rule

> Compose a simple Rule, using a slider that controls the trunk height of an existing tree model.

This procedure builds a single slider that adjusts the trunk height of an existing tree model, working up through the following sections.

> **Note:**
>
> To get proper and meaningful results from this example Rule, you need to use a tree with a first level branch generator named "Trunk" that can afford a height value between 20 and 80. For example, use the Conifer available in the Samples provided with the Modeler.

## Create a slider

1. From the menu, select **Window** > **Rules**.

2. In the script editor of the [Rules window](./rules-window.md), compose the following statement:

   ```lua
   HeightValue = rule("Height", 45.0, 20.0, 80.0)
   ```

3. Click anywhere outside the Rules window.

The UI section of the Rule window displays a slider named **Height**. The slider allows you to change the value of a variable named `HeightValue` between `20` and `80` and the default value is `45`.

## Make the slider control the trunk height

1. Select the Trunk generator of the tree.

2. In the Property Bar, select the **Spine** tab.

3. Under **Spine** > **Length**, right-click on the **Absolute** property and select **Copy edit line for script**.

4. Under the first statement you composed in the Rule editor, paste the copied information:

   ```lua
   HeightValue = rule("Height", 45.0, 20.0, 80.0)

   set_property_value("=Trunk", "Spine:Length:Absolute", VALUE)
   ```

5. Update the `VALUE` parameter of the `set_property_value` function to match the Rule's variable name (`HeightValue`):

   ```lua
   HeightValue = rule("Height", 45.0, 20.0, 80.0)

   set_property_value("=Trunk", "Spine:Length:Absolute", HeightValue)
   ```

6. Click anywhere outside the Rules window.

When you adjust the slider, the trunk of the tree gets longer or shorter.

## Additional resources

* [Introduction to Rules](./rules-introduction.md)
* [Anatomy of a Rule](./rules-anatomy.md)
* [Create a Rule to combine properties](./rules-combine-properties.md)
* [Rule script helpers in the Property bar](./property-bar.md#rule-script-helpers)
* [SpeedTree functions usable in Rules](./rules-speedtree-functions.md)
* [Lua scripting reference documentation](https://www.lua.org/manual/)
