- Home /
Camera losing image effects from scene to scene.
I'm using the standard image effects for bloom in one main camera from scene to scene, but when I go from one scene do another the image effects are lost and I have no clue as to why. Should I keep the same camera from scene to scene making sure it's not destroyed or is there anything else I could do?
I forgot to mention that the scenes have cameras with the same effects. And when I play them separately they work, but when I make a transition from one scene to the other, only the scene I started in has the image effects. Sorry if the question sounded confusing.
I'm not sure why this could be happening, but provided you don't have any code altering the camera components, it may just be something I'm not thinking of.
$$anonymous$$y temporary solution would be to create a "Camera Spawner," where each time the scene loads, it does something like
public GameObject Camera; //drag your camera prefab in here;
public GameObject CameraDummy; //Your camera will be set to this object's position and rotation.
public Vector3 camStartingPosition;
public Quaterion camStartingRotation;
void Start(){
camStartingPosition = CameraDummy.transform.position;
camStartingRotation = CameraDummy.transform.rotation;
Instantiate(Camera,camStartingPosition,camStartingRotation);
}
Thanks a LOT, that worked for some reason. $$anonymous$$aybe it's just a bug?
Yes, and actually now that I think about it I've run into it before (in Unity 4.6). As I said, it's more likely that it's something we're both doing wrong and missing - but it could also be a bug.
Did you check to make sure that all of the camera effects are enabled (active) when the scene is running? $$anonymous$$aybe somehow they're getting switched off?
Also, I updated my script. I'm sure you got the idea of the CameraDummy gameObject but I just wanted to make that clearer.
Yeah, and thanks for the tips! And all effects were running on the scripts, but only the grain effect was working, while the bloom wasn't. I wasn't really getting it but now it's working ok. I still might be missing something though, if I run into it again I'll double check everything.
Answer by Addyarb · Mar 27, 2015 at 06:56 PM
I have a feeling that only one of your scenes has the image effect on the main camera. The other scenes probably just have regular cameras/cameras without the effect that you're losing, right? The way to get around this is as you said:
Create the camera in one scene
Attach a script with DontDestroyOnLoad(gameObject); somewhere in the start function.
Delete all other cameras in other scenes (this prevents multiple audio listener errors).
Doing this should give the same exact camera effects throughout your scenes.
Please note, if you want to edit your individual scenes, not having a camera may make it difficult. Consider having a camera in those scenes, and then writing a script to disable them in the start function. The script would look something like this:
C#
//Attach this script to the "extra" cameras in your scenes
//that should be removed once gameplay begins.
void Start(){
if(!Application.isEditor){
Destroy(gameObject);
}
}