Export variable of type Camera

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By VanKurt

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?

:bust_in_silhouette: Reply From: code

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

Export (nodepath) var camera

This will allow you to choose a node