0 votes

I want to add an exported variable to my script, so that it's editable in the inspector GUI. For simple data types this works fine:

export(float) var FadeInDuration = 2.0

This variable shows up in the GUI and can be changed there.

Now I would like to do the same for a camera:

export(Camera) var TargetCamera

My script should would then use this variable to do do some fancy stuff with the camera that has been assigned to it in the GUI.

But this won't compile:

Error: The export hint isn't a resource type.

Can I create an exported variable that the user can assign a camera to in the GUI?

Godot version 3.2.3
in Engine by (48 points)

1 Answer

+2 votes
Best answer

You can't do something like that you will need to use

Export (nodepath) var camera

This will allow you to choose a node

by (189 points)
selected by
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.