Also an option would be to have a Singleton that manages and saves all the cameras of the game in an array, and each camera and has the position in which they are in the array
Singleton:
# ...
var cams_arra = []
func add_camera(cam):
cams_arr.append(cam)
return cams_arr.find(cam) #return id
func set_current_camera(id):
cams_arr[id].make_current()
# ...
You Node:
# ...
onready var cam = get_node("my_cam")
var camera_id = 0
func _ready(): # or other function
camera_id = YouSingleton.add_camera(cam)
# ...
YouSingleton.set_current_camera(cam_id)
# ...
this is how i would do it if i had a lot of cameras and i'm constantly changing
Also if you want you can add a function to remove the camera from the array
func delete_camera_by_id(id):
cam_arr.remove(id)
func delete_cam_by_value(cam_value):
cam_erase(cam_value)