Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Switch between scenes

Discussion in 'AR' started by Eiseno, Feb 13, 2018.

  1. Eiseno

    Eiseno

    Joined:
    Nov 1, 2015
    Posts:
    86
    Hello,
    When i switch between menu -> game -> menu -> game
    The first time game works correctly but second time camera and ar not working.How can i stop ar and switch between scenes ?
     
  2. Deleted User

    Deleted User

    Guest

    I believe we're lacking quite some details to be able to give any help here...
    Nonetheless, make sure you attach a "DontDestroyOnLoad" script to your go's managing AR. You want to keep the same AR objects/managers between all scenes and simply set them active or inactive. (enabled/disabled)

    Thats about the best I can suggest without having any more information.
     
  3. Eiseno

    Eiseno

    Joined:
    Nov 1, 2015
    Posts:
    86
    i removed DontDestroyOnLoad because i dont want to keep it all scenes.I dont need ar in main menu scene.Also all my objects in Ar Root so i dont want move my all scene level objects between scenes.

    Another question:
    Should i instantiate enemy,level objects under ar root ? is there another way ?
     
  4. Deleted User

    Deleted User

    Guest

    Well, you got me even more confused now :)
    Here's a logical flow :
    Splash scene with an ARController. The controller script is disabled and the go is DontDestroyOnLoad. The menu is directly loaded.
    The menu has a button which loads the scene and enables the controller script.
    The scene has a button which loads the menu and disables the controller script.

    You keep the controller between scenes and enable/disable it as needed. That is how you :
    Now I still have no idea what your new question is about, but the answer you are looking for is probably :
    Should I instantiate enemy/level objects under an AR Root? Yes
    Is there another way? Yes.
     
  5. Eiseno

    Eiseno

    Joined:
    Nov 1, 2015
    Posts:
    86
    Thank you alex. What is the other way ? I dont want to pass all level and enemies between scenes.