Forum rules - please read before posting.

Menu disappears when the scene changes via the script

edited May 2024 in Technical Q&A

Hello everyone, there is a bug in the InGame menu in the scene when a scene is changed from one scene to another through the script and not through the AC and when the same scene is restarted again the menu does not appear and there is no point in calling the menu in the AC onStart which has no effect.

I'm using the latest AC update but I saw this bug in previous versions.

Comments

  • Is the new scene an "AC" scene, that has been set up using the Scene Manager?

    What's the exact code you're using the switch scene? AC has its own ChangeScene functions you can use to switch scene through code:

    AC.KickStarter.sceneChanger.ChangeScene ("MyScene", true);
    
  • edited May 2024

    Yes . Both scenes are set up. The game has two scenes, stage1 and the game over scene. What happens is that when you return to stage1 the InGame menu no longer appears. The change from Stage1 to the game over wave and then to Stage1 is done by script and not by the AC.

    public void GameOver()

    {
    
        //SceneManager.LoadScene(Final);
    
        AC.KickStarter.sceneChanger.ChangeScene("Final", true);
    
     }
    

    I changed the line of code and this error appeared below when the scene has to change to another.

    Cannot load scene: Invalid scene name (empty string) and invalid build index -1
    UnityEngine.SceneManagement.SceneManager:LoadScene (int,UnityEngine.SceneManagement.LoadSceneMode)
    AC.SceneInfo:Open (bool,UnityEngine.SceneManagement.LoadSceneMode) (at Assets/AdventureCreator/Scripts/Game engine/SceneInfo.cs:213)
    AC.SceneInfo:Open (bool) (at Assets/AdventureCreator/Scripts/Game engine/SceneInfo.cs:81)
    AC.SceneChanger/d__56:MoveNext () (at Assets/AdventureCreator/Scripts/Game engine/SceneChanger.cs:1157)
    UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

  • Do you have the scene "Final" listed in the Build Settings, and what is your Settings Manager's Reference scenes by field set to (in the Saving panel)?

    Try replacing "Final" with the scene's build index number.

  • Yes, the scene is listed, I changed the name ''Final'' to number 7, it didn't work and I also used number 7 in the order of the scene in the listing, which also had no effect.

    I don't understand which save panel you are referring to?

    https://uploaddeimagens.com.br/imagens/dtZgs7Y

  • I changed the name ''Final'' to number 7, it didn't work and I also used number 7 in the order of the scene in the listing, which also had no effect.

    To be clear, this would be without the speech marks - i.e:

    AC.KickStarter.sceneChanger.ChangeScene (7, true);
    

    What is the result of instead creating a new ActionList asset file, adding to it a Scene: Switch Action to handle the scene-change, and then running it either manually, or invoking its Interact function through script?

    I don't understand which save panel you are referring to?

    It's in the Settings Manager.

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.