In my project there are about 10 different cameras. You can change between each one of them by pressing a button.
I want to add a ColorCorrectionCurve to each one of them so instead of doing it manually I have the following function on Awake():
//Add ColorCorrection Script to all cams
for(var camera : GameObject in allCams){
if(camera.transform.name != "Camera_Main"){
var cameraColorCorrectionCurves : ColorCorrectionCurves;
cameraColorCorrectionCurves = camera.AddComponent(ColorCorrectionCurves);
}
}
The component gets added but when I switch cameras I get a white screen for the new camera.
If I edit ANY value on the ColorCorrectionCurves component (WHILE the game is running) then it renders it properly. But why is this happening?
Is the component not getting properly initialized?
Is it because the cameras aren’t being used when the game starts?
I also noticed that if instead I add the components on the Start(): I get this error for each camera, and I don’t understand why that happens:
Missing shader in Camera_DetailObj (ColorCorrectionCurves)
UnityEngine.Debug:Log(Object)
Any help very appreciated!