Lab 030 – The Basics of RealityKit Behaviors
A few simple examples of RealityKit behaviors in Reality Composer Pro.
Overview
I’m attending the MIT Reality Hack this week. This morning I met a few developers who had not heard of behaviors/timeline in RealityKit. I wanted to put something together to help people get started. In the future I’ll create a longer series of examples for this topic.
Getting Started
- Create a timeline: In Reality Composer Pro, open a scene. In the bottom section of the app, select the tab called Timeline. Use the plus button to add a new timeline.
- Name the timeline (optional). If I have a complex scene I like to name my timelines with their entity name. For example, I have an entity called
Subject_1so I named this first exampleSubject_1_Move. - In the right side of the timeline editor you will see a list of actions. Let’s start with a “Transform To” node. This will let us apply a new transform to an entity over time. For example, we could change positions, scale, rotate, or even combine these. For the first demo we will move the entity from 0 to 1 on the x axis.
- Drag the Transform To action into the timeline and make sure to select an entity for the Target. Enter 1 in the X axis of the position.
You can see a preview of the movement in the scene. You can also press play on the timeline to see it in action.

Make a timeline loop
Let’s add a second action to the timeline to move back to the starting position. If you play the timeline now you will see the entity move from 0 to 1 and back to 0.
Making a timeline run on a loop is simple, but not obvious.
- Create a new timeline and give it a name. I called mine
Subject_1_Loop. - With the new timeline selected, drag the other timeline into it. We can use other timelines as actions in this timeline. Or put another way, timelines can have run child timelines.
- Select the child timeline in the loop timeline and select the option “Repeat Forever”.
When we play the loop timeline we will see the entity move back and forth.
Using our timeline
Now that we have some timelines that perform actions, we need a way to activate the.
- Select an entity and add a new Behaviors component.
- Select on of the Behavior options. I’m using “OnAddedToScene” for this example. We also have “OnTap”, “OnCollision”, and “OnNotification”.
- Select the timeline we want to run. I selected
Subject_1_Loop
When we load this scene on device or in the simulator the timeline will start playing on a loop.
These are the basics of behaviors and timelines, but we I’ve barely scratched the surface. We can explore the list of actions. We can change animation timing functions. We can trigger timelines using taps or collisions. We could even use notifications to trigger a timeline. Then, we use the Notification action to tell our app when it has completed. This allows us to create a two-way communication layer between our app and timelines. There is so much more to cover, but this should get you started. Let me know if you need help with your timelines or behaviors.
Support our work so we can continue to bring you new examples and articles.
Download the Xcode project with this and many more labs from Step Into Vision.

Follow Step Into Vision