Audio Sync Advice Needed

by user 908977119781060648

For ref: the Rotate script from your scripting examples works perfectly.

by user 908977119781060648

Can you share your typescript file?
You need to put the onPointerDown check in e.g. the update() { ā€¦ } Function

Hi @marcel :cactus: ā€¦ huge apologies for the delay, I was buried in work yesterday.

The script is:-


export class Play extends Behaviour
{
    
    start(){
        // logging this is useful for debugging in the browser. 
        // You can open the developer console (F12) to see what data your component contains
        console.log(this);
    }

    // update will be called every frame
    update(){
        if(this.context.input.getPointerDown(0)) timeline.play();
        
    }
}```

Note: in place of `timeline.play` I've tried each the following. None of which worked, unfortunately:-

`cube_animTimeline.play`
`cube_anim.play`
`PlayableDirector.play`
`Animation.play`

*by user 908977119781060648*

Have just tried it again this morning, and the script now is allowed to be addedā€¦

by user 908977119781060648

.
Howeverā€¦

by user 908977119781060648

I get the following when I view the scene

by user 908977119781060648

This should work:


import { Behaviour, serializable } from "@needle-tools/engine";

export class Play extends Behaviour
{
   @serializable(PlayableDirector)
   timeline : PlayableDirector;
    
    update(){
        if(this.context.input.getPointerDown(0)) this.timeline.play();
        
    }
}```

Hi again @marcel :cactus: ā€¦ and as always, huge thanks for your time and expertise :slightly_smiling_face:

I modified the script as suggested, but unfortunately itā€™s still thrown up some issues, detailed in this imageā€¦

by user 908977119781060648

by user 908977119781060648

Iā€™m afraid I donā€™t know enough about what to do to affect the fix that VS recommends.

Perhaps it will shine a light on things for you, though? :crossed_fingers:

by user 908977119781060648

This was the VS suggested solutionā€¦

by user 908977119781060648

by user 908977119781060648

As said, sadly I donā€™t really know what Iā€™m doingā€¦ but hopefully the VS Quick Fix info will make sense to you :slightly_smiling_face:

by user 908977119781060648

So when you put the component on an object in Unity, it should have a public property called ā€œTimelineā€ where you should drag your Timeline object into the slot

Sounds like itā€™s just not assigned

The error that VS Code shows there should go away if you change it to
timeline?: PlayableDirector; (with a question mark), but it should also not hurt

Thanks @herbstšŸŒµ Iā€™ll give that a try.

In the meantimeā€¦ is there anywhere on this screenshot which indicates where I might need to make the assignation youā€™ve described?

by user 908977119781060648

by user 908977119781060648

Yes :slightly_smiling_face: