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 ā¦ 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
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 ā¦ and as always, huge thanks for your time and expertise
I modified the script as suggested, but unfortunately itās still thrown up some issues, detailed in this imageā¦
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?
by user 908977119781060648
This was the VS suggested solutionā¦
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
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