Forum rules - please read before posting.

Saving camera switch

edited November 2017 in Technical Q&A
Is it really necessary to switch cameras from AC action list for save system to remember what camera is currently active? I'm switching my camera with a custom script:

mainCamera.enabled = false;
camTwo.enabled = true;


and the save system is not saving this change. Is this normal behaviour? All cameras have Constant ID scripts on them. The weirdest thing is when I exit and start the game again and load a saved game it loads what camera was active when I saved the game(only if I'm in a different scene than the one in which save game was made), but during game play when I try to load it just remains on the camera that it's currently on.

P.S.
When I end Dialogue System conversation all my global and local AC variables get reset to default values, is that normal? If so, would like to know how to prevent that.

Comments

  • Welcome to the community, @kole90.

    It is not necessary to use the Camera: Switch Actions, but you must instead use the SetGameCamera function - as opposed to manually amending each camera's enabled state:

    AC.KickStarter.mainCamera.SetGameCamera (camTwo);


    Where 'camTwo' is an AC GameCamera with a Constant ID component attached (for saving to be recorded).  Note that it will not save correctly if you disable the MainCamera - instead, you must let the MainCamera attach itself to whichever GameCamera is your 'active' one.

    As for your issue with Dialogue System, you're referring to this asset?  If so, you should contact that asset's author (@PixelCrushers), as that doesn't sound like something AC would be doing on its own.
  • Hi Chris,

    Thank you for your welcome as well as for your fast and detailed response. It worked, and I wanted to add just few things for people that will maybe run into this problem. I will basically simplify the stuff you said.

    In order to use this function on cameras that you created without AC Scene Manager:

     AC.KickStarter.mainCamera.SetGameCamera (camTwo);

    you will have to declare all the cameras in your script as _Camera (AC cameras) instead of Camera and main camera as MainCamera, and don't forget "using AC" at the top. You will also have to add "Game Camera" scripts on your secondary cameras, and "Main Camera" script on your main camera.
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.