[SOLVED] scripting 2.0 - `app` is undefined?

For some reason the following code doesn’t appear to work in scripting 2.0 but was fine before

this.Camera = app.root.findByName(‘Camera’);

its in the initialization function of a script

any ideas as to whats wrong?

it seems to think that app.root is undefined, how can that be?

app is now this.app.

1 Like

that sorted it, thanks.

how about how to fix this
if(app.keyboard.wasPressed(pc.input.KEY_UP)){
this.entity.translateLocal(0,0,1);
whats wrong

What’s your issue?

If you are getting a syntax error try closing your if block statement, and also add this to your app reference if you haven’t explicitly defined it like that:

if(this.app.keyboard.wasPressed(pc.input.KEY_UP)){
   this.entity.translateLocal(0,0,1);
}