Forum rules - please read before posting.

Camera Fade-In: don't affect UI and back to last camera

Hello community. I just noticed that the camera Fade-Ins affects the whole screen, so when someone hits Esc to pause, if the fade is still "going on" you can see that everything looks dark. For long fades, this can create that the menu is impossible to be seen.

1) Is there a way not to affect certain UI menus or Unity UI prefab menus on these fade-ins?

2) Is there a way to go back to "the last camera" from action list? It's not gameplay, it's actually "the last I used". If there's a way great! There is a reason why: When working with options, one of the options is brightness. It's a camera with an object that is affected by light, so the camera switches to that place but then it has to return to the previous one. On gameplay or even during conversations, this works! but if there's a cutscene, then it jumps to the gameplay one and not the one it was set before. So far I had to disable the possibility of the brightness adjustments during these type of cinematics but maybe by know "which was the last one" I can absolutely have it working even on these type of cutscenes.

Thanks!

Comments

  • when someone hits Esc to pause, if the fade is still "going on" you can see that everything looks dark.

    The Camera: Fade Action's Behaviour when paused option can be used to control what happens in the event that the pause menu is opened during a fade.

    Is there a way not to affect certain UI menus or Unity UI prefab menus on these fade-ins?

    The built-in effect is rendered above all other elements of the scene. If you uncheck the MainCamera's Draw fade? option though, you can have a custom script link a Unity UI Image's alpha channel to the MainCamera script's GetFadeAlpha() value, so that you can set its order relative to other menus.

    Is there a way to go back to "the last camera" from action list?

    This could be done through script, but I'm not clear about your explanation. Is this for a specific Camera only in your Options menu to "test" the options? If you can share more details about the situation, I can advise further.

  • Thanks. The "Hold" option on Behaviour when paused solved it. No need to go further.
    For the second part, yes, it's not tricky but there's a reason to do so.
    So, I'm in gameplay. Camera attached is called "Despacho Master Camera". I go to options, I go to gamma. What it does, is move to another camera which was a single object that is affected by the global light, because it's want we want to adjust. After you close this menu, this goes back "to gameplay" per the AC option. If you are on gameplay this works great. The problem is during cutscenes, like "on start" cuscenes. It doesn't go back to the one which was last used, instead, it goes to gameplay, to the gameplay camera. In pictures you will probably understand it better.

    https://imgur.com/a/BykUxjG

    I was thinking also in a script or something to tell me what was the last one used and not gameplay. Old camera, new camera, and on hitting "back" go to "old camera". Not sure how hard it is. As of now I've disabled the gamma correction on cutscenes but because of this, not because game-design-wise is good.

    Thanks

  • I was thinking also in a script or something to tell me what was the last one used and not gameplay.

    Exactly this. Add the following to the scene, and use the Object: Call event Action to run the component's functions:

    using UnityEngine;
    
    namespace AC
    {
    
        public class BrightnessCamera : MonoBehaviour
        {
    
            public _Camera brightnessCamera;
            private _Camera previousCamera;
    
            public void SwitchToBrightnessCamera ()
            {
                previousCamera = KickStarter.mainCamera.attachedCamera;
                KickStarter.mainCamera.SetGameCamera (brightnessCamera);
            }
    
            public void SwitchToPreviousCamera ()
            {
                KickStarter.mainCamera.SetGameCamera (previousCamera);
            }
    
        }
    
    }
    
  • Thanks! Two things:
    1) Object: call event didn't work as I can't drag the object with the script there. Not sure why. What I always use and work is Send Message-Custom. That way it worked. What's the difference? Is it because I was during a onStart Cutscene?

    2) For a really weird reason, even though the code is correctly written, the previous camera end up being the BrightnessCamera (I put the script on TurnOn). So I noticed that if I put an Engine-Wait or 0.1 or 0.00001 then it correctly assigns the previous one (which is the objective of the script). Maybe the switching of the camera is not so fast? Not sure.
    What I did to correct it is assign a new method with only the line of the previous camera, and then another one to switch. That way it works. Really weird. Maybe it's speed-related.

    Thanks a lot as always.

  • Object: call event didn't work as I can't drag the object with the script there.

    Which object - the GameObject the script's attached to?

    If you're dealing with ActionList assets, you won't be able to reference a scene object - but you can make the GameObject a prefab and have the Action reference the prefab instead. To run the script's code, it doesn't need to be in the scene.

    I noticed that if I put an Engine-Wait or 0.1 or 0.00001 then it correctly assigns the previous one

    I'm not totally following things without the full context, but an Engine: Wait Action of -1 will wait exactly one frame - that should be safer than setting simply a low value.

  • Hello! You understood right the second part! It works flawlessly. I've never though of negative frames to be honest. Thank you very much. Very helpful.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.