How access component from node?

How access component from node?
0

#1

Component usually accessed through node.getComponent(cc.Camera);
what if node have multiple cc.Camera components as node.getComponent(cc.Camera); return only one cc.Camera component then how to access all cc.Camera components ?


#2

I just got the solution, Iterate through 'node._components’ and detect cc.Camera components


#3

I would suggest to use component properties, and have references to both cameras.
properties: {
camera1: cc.Camera,
camera2: cc.Camera
},