(solved) Camera documentation tells me to use "camera.acquire_focus", but it gives me a nil index error?

Heyo!

Really quick question,

In the Camera documentation (https://defold.com/manuals/camera/) under “Using the camera”, it says I can either use:

camera.acquire_focus("#camera")

or

msg.post("#camera", "acquire_camera_focus")

The latter works great and I got stuff to render fine, the but former, “camera.acquire_focus” gives me an error:

attempt to index global 'camera' (a nil value)

This makes sense to me, nowhere in the script do I tell Defold exactly what camera is. However none of the docs I’ve been able to find have explained to me how I can reference components through a variable.

Everything about addressing components or gameobjects things talks about using hashtags and strings, but nowhere does it explains how I can define “camera”.

My hierarchy for reference:
2024-02-25_14-44-21_java_Woozy_Coqui

So does anybody know how I can do stuff like:

local camera = [insert code how to reference camera here]

Thanks! :smiley:

1 Like

This is a new function, coming up in Defold 1.7.0.
We’ve accidentally added it prematurely to the documentation. Sorry about that.
We’ll release a beta with this functionality next week.

5 Likes

Oh, wow, neat! Thanks!

Can’t wait, seems super useful! :slight_smile:

I hope it improve camera function. TBH: I’m still using britzl orthgraphic camera because it’s easier and more robust. I’d love a better built in solution.