Forum rules - please read before posting.

Transitioning to a Non-AC scene

edited March 2020 in Technical Q&A

Hello there,

Unity Ver: 2019.2.4f1
AC Ver: 1.70.4

At the end of my game I want to transistion back to a main menu scene. This is a scene which doesn't use AC at all.

At the moment the transistion occurs from the ending scene using Scene:Swtich, but what happens is the player object is carried into in the main menu via DontDestroyOnLoad. This is not what I want.

How would I go about switching AC off at this point?

P.S Am I ok to mix scenes like this, or, would it be best practice if all my scenes were AC made?

Thanks!

Comments

  • AC will turn itself off automatically when entering a non-AC scene - you should get a message in the Console about this.

    At this point, AC won't do anything - so anything like deleting the Player has to be done manually. This can be done via a script in the MainMenu scene, i.e.:

    Destroy (GameObject.Find ("MyPlayer"));
    

    More on how AC handled transitions to/from non-AC scenes can be found in the Manual's "Integrating other gameplay" chapter.

    Mixing AC and non-AC scenes should be fine - though I'd recommend that a main menu scene would be an AC one. This is because you'd typically have "New Game", "Continue", "Load" etc buttons, which would need to rely on AC Actions or function-calls to clear data, restore it, etc. It's all up to your own needs of course, though.

    If you want to limit AC's "presence" in a scene, there's a couple of things you can do:

    1. Use the Engine: Manage systems Action to disable various unwanted systems, e.g. Interaction, Movement, as well as change the "Movement method".
    2. Create a "dummy" local Player that's just an empty GameObject with the Player component. This will override your regular Player for the duration of the scene.
  • @ChrisIceBox Great shout about the game continue & load - I haven't tackled saving yet, but its only a matter of time so it makes sense to build the main menu in a futureproof way.

    AC it is!

  • edited March 2020

    Hey @ChrisIceBox just a follow up on this in case there is a bug;

    AC will turn itself off automatically when entering a non-AC scene - you should get a message in the Console about this.

    I'm not seeing anything in the console about AC turning off after moving to a non-AC scene. The blue line in the image below marks the moment of changing scene.

    For help, this is what the AC editor looks like with the scene open (I assume this represents a non-ac scene?)

  • My mistake - it won't tell you, but it should indeed have gone to sleep.

  • @ChrisIceBox No worries. I've gone ahead and rebuilt the main menu as an AC scene (using your excellent tutorial!).

    This has resulted in a curious problem though;

    • If the player is deleted in the main menu scene, the transition to the gameplay scene produces a player with no WASD movement.

    • If the player isn't deleted in the main menu scene, the transition to the gameplay scene produces a player which is fine.

    Does that sound like something worth investigating?

  • I'm currently working on the player-assigning code as part of the next update, so I'll make a note to look into this as well.

    In the meantime, probably best to just keep the Player in the scene and out of view!

  • In the meantime, probably best to just keep the Player in the scene and out of view!

    You're absolutely right, that does seem to be the best thing to do. I'm going to hide them in a corner somewhere.

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.