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.

When using LoadSceneMode.Additive, the next scene with ARkit is not working properly?

Discussion in 'AR' started by zyonneo, Mar 13, 2019.

  1. zyonneo


    Apr 13, 2018
    When I click ViewAR it Loads the next scene
    Code (CSharp):
    1. SceneManager.LoadScene("scene2", LoadSceneMode.Additive);
    In the second scene I am using ARkit to detect a plane and using UnityARHitTestExample I am placing an object on the detected plane.I cannot place objects on the plane but if I use
    Code (CSharp):
    1.  Loadscene.Single
    in the above code it works smoothly.

    The reason I am using LoadSceneMode.Additive is that when I hit back button from the scene 2 it should go exactly where I left in scene 1.That is if my scene 1 contains two pages,at start if I hit next it reaches second page.In the second page I have ViewAR button which when clicked goes to scene 2.From scene 2 when I hit back button it should return to page 2 in scene 1.

    Code (CSharp):
    1.  public void ViewAR()
    2. {
    3.     PlayerPrefs.SetInt("Option", Buttonoption);
    4.     ProductDetails.SetActive(false);
    5.     ViewARbtn.SetActive(false);
    7.     StartCoroutine(Changescene());
    9.     SceneManager.LoadScene("Scene2", LoadSceneMode.Additive);
    12. }
    14. IEnumerator Changescene()
    15. {
    17.     SceneManager.UnloadSceneAsync("Scene1");
    18.     yield return new WaitForEndOfFrame();
    20. }
    The problem here is two scenes are interfering when I use Additive is what I think.I do not want to reload the first scene at the same time I cannot use
    Code (CSharp):
    1.  LoadSceneMode.Additive
    .Any solution on how to get back to scene 1 when I hit back button in scene 2?
    Last edited: Mar 14, 2019