how to set current property of camera by gdscript?

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

extends Camera2D
func _ready():
Camera2D.current = true
i get error this script(attached to camera)
Sorry about the rudimentary question
i can not find this setting by code.

:bust_in_silhouette: Reply From: Zylann

Your script extends Camera2D, so current is accessible as a member variable. You can set it by just writing:

current = true

thanks!Does the extends mean like using in c#?

bgegg | 2019-03-08 22:49

You used GDScript, and your script starts with extends Camera2D, so it extends (or inherit, if you prefer) Camera2D.

Zylann | 2019-03-09 00:22

yes.understanded.

bgegg | 2019-03-09 01:49

:bust_in_silhouette: Reply From: CKO

You should use make_current() method of Camera2D:

extends Camera2D

func _ready():
    make_current()