The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates.

godotengine.org | Twitter

0 votes

Hi
I want to do get_viewport().get_camera() in godot 4 but it tells me there is no get_viewport() any more... I should probably use get_camera3d() or some such but I need to solve the viewport problem first. Can anyone help?

Godot version 4.0 pre-alfa
in Engine by (513 points)

it tells me there is no get_viewport() any more

Are you sure about this? It's still a public method in Node on the master branch: https://github.com/godotengine/godot/blob/master/scene/main/node.h#L460

Maybe post a screenshot of the error in the editor?

I downloaded the latest 4.0 build and there doesn't seem to be a problem:

get_viewport

Are you sure your script is on a Node and not a Resource or something else?

It just says 'no function "get_viewport()" in base self'.

What type of node is your script attached to? Please show the top of the script including the extends blahblah

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.