所以 let c:cc.Camera = cc.find("camera_gun") as unknown as cc.Camera;
这样是错误的。 实际上要这样
let c:cc.Camera = cc.find("camera_gun") as unknown as cc.Camera; //这样是不行的,要用 getComponent(cc.Camera) let c_ = cc.find("camera_gun"); c = c_.getComponent(cc.Camera);
那为什么说 cocos 坑呢? 因为用 as unknown as cc.Camera 也可以直接操作