- Home /
How to control Tracked Image Prefab - AR Foundation
Ahoj everyone :) I am trying to create a simple AR app. Imagine I am tracking an image and on top of that image I am spawning Tracked Image Prefab. Let's say this prefab is a model of a dragon with some fire effect on its timeline. And I want to control the prefabs timeline when it is instantiated by AR Foundation. For example, I want to play fire animation with a button click.
Can I put a listener on the prefab to trigger the timeline in runtime? How can I do it, please?
Answer by seant_unity · Feb 24, 2020 at 12:32 PM
If your prefab has a PlayableDirector with a timeline attached, and it is set to PlayOnAwake(), then the timeline should start when the prefab is instantiated, no script required.
Thank you! You are right, I needed to play the timeline after button is pressed. I figure it out with Events and Delegates.