How to find entity ID

I can’t find out how to get an entity ID and im trying to for a script

Hi @Nicholas_Taylor1,

PlayCanvas entities have a guid assigned internally, though that’s a private property and usually it shouldn’t be directly used.

If you know what you are doing, you can access it like this (unofficial API):

const id = this.entity._guid;

ok, where would I put this

What do you need the entity ID for?

Camera

What do you mean camera? Please try to be more descriptive to get more help.

sorry I’m trying to get the Id for a camera to move and rotate it in a script

If you know the camera name (e.g. name) you can get it like this in your script:

const cameraEntity = this.app.root.findByName('Camera');

No need to use an ID.

oh ok thank you!

When I use it it says
image

Where are you using that? Share your code so we can help you.

ok

oh wait never mind i deleted the script

im running into the same kinda problem. death.js
https://playcanvas.com/editor/code/1043202?tabs=131883627,123914274