Forum rules - please read before posting.

Scene Management Questions

So I have 2 types of scenes. Scenes that just contain cutscene files, in those scenes they load in the environment using Add Scene action. (This is so that I can make changes to the environment models if necessary)

I also then have gameplay scenes that allow me to move from 1 gameplay scene to another (This is when I control the character). The gameplay scenes contain the environment models.

Both of those scenes have the player in them, (In the cutscene I put the player prefab in the scene) while the player is spawned in the gameplay scene.

I load in the cutscene scene first then add the gameplay scene using the add scene action. When the cutscene finishes and I want to move to gameplay, but unable to set the gameplay scene active.

I tried using playmaker to set the gameplay scene active after the cutscene has finished, but the player prefab was deleted in the gameplay scene as Adventure creator recognized the player from the Cutscene scene.

So is my whole process wrong?

if the main camera in the gameplay scene is active, when the cutscene finishes, for some reason the main camera in the cutscene scene doesn't work at all. if it helps, im using invectors third person controller and camera. If i turn of the camera in the gameplay scene, it works fine. However it means if I go back to that gameplay scene from another gameplay scene and the camera is off, then of course it doesn't work.

i hope this makes sense.

Comments

  • I'm afraid I'm not entirely sure on what issue you're describing. That you can't make the gameplay scene active? Beyond this, what are the effects of this in terms of what actually happens when the game runs?

    If you use the Scene: Switch Action, as opposed to Scene: Add or remove, then all open scenes will be closed in favour of the new one - you can treat it like a "hard reset" when additive scenes are involved.

    If, when multiple scenes are open, the active scene is removed, then AC should automatically switch to the scene that Unity considers the new active scene. Removing the Cutscene scene should make the Gameplay scene active, if those are the only two involved.

    If you enable AC's Status box at the bottom of the Settings Manager, it'll list all open scenes - as well as which is considered the "active".

    Unless you have need for e.g. lightmapping data, one alternative would be to load in your environment etc as prefabs, as opposed to scenes.

    Are you able to break the issue down into clear steps without the use of another asset? Please try to describe if/how I can recreate the core of the issue using AC alone.

  • Ok to break it down. I have a game that allows me to travel between scenes during normal gameplay i.e. when the player can roam around and talk with characters,

    I need to be able to freely move between gameplay scenes (town, forest, lake) so I need them to be 1 scene that I can add additively when i need them for like a cutscene. These cutscenes dont have the game environments in them.

    I decided to split the scenes between those gameplay scenes which involve different environments and scenes which have cutscenes in them that advance the story.

    The gameplay obviously have a main camera with a camera script and so does the cutscene scene.

    I spawn the player in the gameplay scenes using AC, (I set in the player in the settings menu and use player marker) and in the cutscene scene I have the character already in the scene as they are involved in the cutscene.

    The cutscene scenes dont have the game environments in them so I load them using the Add Scene action so they are like a subscene and the environment scenes are also the same as the gameplay scenes.

    When the cutscene finishes playing I want to move back to gameplay, the cutscene scene is the main active scene. If the camera in the subscene which is the environment/gameplay scene is active then the camera in the main active scene (The cutscene, scene) does not work i.e. it doesnt follow the character around properly. (I think this is because there is another main camera in the subscene_

    However If I turn off the camera in the gameplay scene, save it and then add it through the cutscene scene, after the cutscene has finished the camera works fine and im able to continue and the camera in the cutscene scene which is the main active scene works fine i.e. follows the character around.

    2 scenes.
    1 cutscene, 1 gameplay scene containing scene assets.
    Both scenes have main camera. (Im using Invector's TPC as my main character controller)
    When cutscene in cutscene scene starts, it adds the gameplay scene containing the environment assets.
    When cutscene finishes, if camera is active in gameplay scene and the cutscene finishes, camera doesnt follow character around. by this time the main active scene is still the cutscene scene.

    If main camera is inactive in gameplay scene and cutscene finishes, then the camera works fine in the main active scene which is still the cutscene scene.

    I can't use switch scene action to the gameplay scene because sometimes, the cutscene scene can have items I need that can work with so i might need the cutscene scene to still be there.

    I hope this breakdown is easier to understand.

    As an addition, when I tried using Playmaker to set the gameplay scene active after the cutscene finished, the player in the gameplay scene was deleted when the scene was additively added because the player was already in the cutscene scene.

  • edited January 2021

    Also is it possible to run an onstart cutscene from a scene I add additively without it being active?

    In the settings menu, If l click "scene loading requires manual activation" how do I manually activate the scene?

  • What's your AC version?

    When you have an AC scene open, and you add another AC scene, the MainCamera in the new scene should disable itself automatically.

    Leave any other assets out of things for the moment - it's first necessary to determine if this is an issue with AC alone, or due to the presence of other assets.

    When cutscene finishes, if camera is active in gameplay scene and the cutscene finishes, camera doesnt follow character around. by this time the main active scene is still the cutscene scene.

    Which character? The Player, to be controlled during gameplay? Spawned or in the Cutscene scene? Are you switching camera at this time, or looking to have the camera active at the end of the cutscene be following the player during gameplay that then follows?

    It sounds like this could be to do with your mix-and-matching of spawned players vs in-scene players, which may cause issues when also mixing scenes. So that there's no ambiguity over which Player should be used and when, you should have AC rely on the spawned Player at all times.

    If your cutscenes don't need to show the Player character transitioning to/from cutscenes (i.e. "Uncharted" style), then I recommend making your Cutscene Player an NPC instead - you can convert a Player to an NPC via the cog icon in their Inspector. You can then hide the "real" Player during the Cutscenes, and swap them with their NPC counterpart at the end of the Cutscene.

    If you do need a more seamless transition, where the same Player during gameplay is also used during Cutscenes, then you'll have to check "Is Player?" in your Cutscene's various Actions that deal with him. If you're using Timeline for your Cutscenes, you can use a "stand-in" character in your Timeline tracks, and re-bind those tracks to the Player using the "Engine: Control Timeline" Action.

    It's best to break such an issue down into its simplest form. Try creating a new pair of such scenes, a single camera in each, and use this to recreate the problem in the most clear / simple way. Again, without any other assets for the moment. That'll then help make the issue more clear should the above not be enough.

    is it possible to run an onstart cutscene from a scene I add additively without it being active?

    The "Scene: Add or remove" Action has a "Run 'Cutscene on start'?" option.

    In the settings menu, If l click "scene loading requires manual activation" how do I manually activate the scene?

    See the Manual's "Loading scenes" chapter. It's a case of calling:

    AC.KickStarter.sceneChanger.ActivateLoadedScene ();

  • edited January 2021

    I'm using AC 1.72.4, Unity 2019.4.2f1

    "Which character? The Player, to be controlled during gameplay? Spawned or in the Cutscene scene? Are you switching camera at this time, or looking to have the camera active at the end of the cutscene be following the player during gameplay that then follows?"

    Yes I mean the player character I used for the cutscene.

    "If your cutscenes don't need to show the Player character transitioning to/from cutscenes (i.e. "Uncharted" style), then I recommend making your Cutscene Player an NPC instead - you can convert a Player to an NPC via the cog icon in their Inspector. You can then hide the "real" Player during the Cutscenes, and swap them with their NPC counterpart at the end of the Cutscene."

    Which cog icon? I cant' find it in my inspector.

    "The "Scene: Add or remove" Action has a "Run 'Cutscene on start'?" option."

    This doesn't work. I have on start cutscene set. It doesn't seem to run when I use Scene:Add or remove even when I click the run cutscene on start option. IS there an example somewhere? DOes the scene have to be active before It can run the cutscene or can the cutscene run the moment the scene is added additively but not the active main scene.

    Also, how do use the "Position Player relative to marker" in the Scene Switch action because that doesn't work for me too.

  • Which cog icon? I cant' find it in my inspector.

    It's in the top-right of any Unity component.

    It doesn't seem to run when I use Scene:Add or remove even when I click the run cutscene on start option

    How about "Run if already open?"?

    Check your Console for warnings - it should report if the scene hasn't been loaded properly. I can't recreate an issue with this option on my end.

    One way to debug this is to open ActionSceneAdd.cs, and place the following at the top of the PlayStartCutscene function:

    Log ("Play start cutscene of " + sceneSettings, sceneSettings);
    

    Does this show in the Console?

    how do use the "Position Player relative to marker" in the Scene Switch action because that doesn't work for me too.

    It's not going to be used if you're adding scenes, or if the Player doesn't rely on a PlayerStart during the transition.

    This sounds like an unrelated issue to the above - let's create a new thread with more details so we can look into it separately.

  • edited January 2021

    Ok... I found the convert to nPC cog. Is it possible to convert player to npc using an AC action during a cutscene and back to player when the cutscene is finished.

    The run if already open worked so that is helping.

  • Is it possible to convert player to npc using an AC action during a cutscene and back to player when the cutscene is finished.

    No - it's an Editor-only operation.

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.