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 @marwie1 :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 @marwie1 :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: