https://playcanvas.com/editor/scene/1569682
This is the line of code that is causing the issue: this.entity.sound.slot(‘Slot 1’).pitch = Math.random()+0.5;
Can you help?
I’m trying to randomize the pitch of the laser, but when i run my game a error message pops up
Hi @Bradley_Pelletier! Make sure this.entity
is the entity with the sound component. If the entity with the script is not the entity with the sound component, you can not use this.entity
.
Another issue is that the update function of the InputHandler script is not closed correctly. There is missing }
and };
at the end of the script.
1 Like
Thank you, I’ll try it out and let you know if it worked.