Hi⦠so, Iām not sure that the following is particularly Needle and/or Unity-related but Iām hoping someone might be able to help.
Basically, I have a .glb which has a looping animation set to āPlay Automaticallyā using the animation component. This works perfectly and the animation plays exactly as expected.
I also have an audio track which needs to accompany the animation and run/loop in sync with it. However, of course even with āPlay On Awakeā checked in the āAudio Sourceā component the track wonāt begin playing until there has been some user interaction (i.e. rotating the view of the scene or similar.)⦠by which time itās out of sync with the animation which has already been running.
I know that the āuser interaction to start audioā thing has always existed⦠with all web content⦠since the dawn of time
⦠but Iām trying to ascertain what might be the best solution in this instance? I donāt necessarily need the animation to start right away, so perhaps, instead of it playing automatically, thereās a way to set the animation to only begin playing on user interaction, in the same way as the audio so they run in sync with each other?
Or maybe thereās a better way to achieve what Iām aiming for?
Any thoughts or advice will be very welcome 
Original Post on Discord
by user 908977119781060648
so usually this is solved by having some sort of āPlayā button front and center, and when someone clicks that both audio and animation play in sync
For actually playing in sync and not deviating: usually you check the time offset between audio and animation and decide which one should be corrected if the time offset becomes bigger than, say, 0.1s
We do this internally for Timeline tracks - so if you just add your animation and audio to a Timeline in Unity that will be taken care of already
As felix said: all you need to do is playing your animation via a timeline, then our engine tries to take care of that as best as possible
- Add a PlayableDirector component to a gameobject in your scene
- Create a timeline asset
- assign the timeline to the playable director
- add a audio track to the timeline and drag your audioclip onto the track
- add one or multiple animation tracks to the timeline and assign the animations (see docs:
https://docs.unity3d.com/Packages/com.unity.timeline@1.8/manual/wf_instance.html)
You could have a look at the scrollytelling scene from our samples to see a simple reference (or import the timeline samples from unityās timeline package via the package manager window)
Brilliant! Huge thanks, as always. That all sounds absolutely ideal - Iāll get right on it 

by user 908977119781060648
You could of course hook into e.g. the AudioSource.audio (which is the threejs SpatialAudio class i think) and use the events to start and update your animation manually too and try to keep it in sync
Ooooooo, right⦠Iāll have a look.
It sounds a lot less elegant than your earlier suggestions, though, so probably not a great way to go. It was just curiosity, really 
by user 908977119781060648
You can totally do that! E.g. there could be a character with an idle animation waving at you, and once you do anything (click, drag, interact) another animation + synced audio plays
Lots to experiment with 
by user 908977119781060648
Okay, so despite several days (and nights) wrestling with this Iām really not getting anywhere with my hoped-for outcome.
THE DISCLAIMER 
It should be noted that the failings Iām experiencing are down to my own ineptitude, not Unity or Needle problems.
**THE UPS & DOWNS **
Iāve successfully created a PlayableDirector with an associated timeline asset - and when I set it to āPlay On Awakeā the timeline runs as anticipated. So far, so good

However, what I need it to do (and what Iām singularly failing to achieve) is for it to only begin playing on user interaction.
Iāve unchecked āPlay On Awakeā in the PlayableDirector (which successfully stops the timeline from playing automatically) but have been unable to find a way to make it start playing when required 
As mentioned previously, in an ideal world what Iād really like is for the timeline to be triggered to play as soon as the user begins exploring the scene (via the orbit controls, for example).
However, I havenāt had any luck trying to find general info about how to go about achieving that. So, instead, Iāve tried to trigger it via a button⦠but Iām obviously doing something terribly wrong as none of the various, and undoubtedly messy, permutations that Iāve concocted make it run 
by user 908977119781060648
THE PLEA FOR HELP
So, basically Iām trying to find a simple, straightforward walkthrough (if one exists) describing how to make either of the following happen:-
1). The PlayableDirector with its associated timeline starts playing as soon as thereās a user interaction (preferred).
2). The PlayableDirector with its associated timeline starts playing as soon as a button is clicked (happy to go with that if option 1 isnāt viable).
THE SCRUTINY OF MY VERY SOUL 
I have a horrible sinking feeling that all my troubles and woes can be placed firmly in the āI donāt know anything about Unityā category. A problem compounded by the fact that I find Unity seems to insist on even the simplest of tasks being an exercise in labyrinthine torture; something which has made me reluctant to pursue it much in the past.
ISNāT THERE ANYTHING FASTER THAN A MICROWAVE?
At nearly 60 years old⦠so, with time being in rather shorter supply than it was when I was younger
⦠I have a relatively recently acquired predilection for trying to cut straight to the chase. Sigh. I guess thatāll have to change and Iāll just have to knuckle back down and do the work 
by user 908977119781060648
Hello @frannie
can you disabling play on awake and add a tiny script that does something like this: if(this.context.input.getPointerDown(0)) timeline.play()
?
Hi @Marcel_Wiessler1
thanks for the suggestion⦠Iāll give that a goā¦
by user 908977119781060648
Also thank you for that detailed message! Weāll figure this out together 
Hmmmmmm⦠it doesnāt like something about my latest efforts. Iām now being repeatedly prompted to redo the export setup each time I make any changes. So, Iām going to ditch this test project and make a new version. Iāll pop back with more info when I get sorted 
by user 908977119781060648
Sadly, no joy thus far today.
Iāve made several new test projects (all collab sandboxes) to try the above suggestion in a fresh environment, but each time I get the following (attached)
by user 908977119781060648
by user 908977119781060648
Sorry, hereās the more comprehensive pic that I meant to postā¦
by user 908977119781060648