Slow mo script help
Hello.
I'm trying to make a lens with lower frame rates, and because I can't script I found that script:
// @input Component.Camera camera
// @input float framerate = 10
var countdown = 0;
function onUpdate() {
countdown -= getDeltaTime() * script.framerate;
script.camera.enabled = (countdown <= 0);
if (countdown <= 0) {
countdown += 1.0;
}
}
script.createEvent("UpdateEvent").bind(onUpdate);
Sadly its not working and gives me this error:
[Scenarium] TypeError: cannot write property 'enabled' of undefined
at onUpdate (Script.js:8) preventsyield
Can someone help me with that or is able to fix the script?
Thanks.
It sounds like you haven't selected the camera property. The "// @input" lines mean that after you add the script to your scene, you then need to specify those properties in the Inspector Panel. Once you do that the script should stop giving errors. More info on script properties here.
Hey, thanks. It doesn't show me the error now anymore. But the script is still not working, sadly.