Forum rules - please read before posting.

Pause when turning on menu

I have an action that is run from a menu (not in scene) and the first time I open this menu and run the action list in the build there is a slight pause of the game, but only on the first time I run it. Any idea as to why this might happen? It is only when it happened first time? and happens in any scene when menu is clicked first time so is non scene dependent.

See video:

https://www.dropbox.com/s/odduf5mgarplpz4/PasueOnMenuOpen1stTime.mov?dl=0

Comments

  • The lag in the Editor appears to be when the phone menu is turned on, but at runtime it appears to be when the conversation menu turns on. Are you referring to the same menu in both recordings, or experiencing lag with both of these menus?

    How heavy are they, in terms of texture filesize etc? Try compressing the texture assets involved.

  • edited February 2022

    The lag is in the build, not in the unity project. And it only happens first time when opening the menu. And the lag is only with the MobileAll UI menu. Could it be something to do with searching for the resources. Once it has build the index it's fast? THere is no sound being played though

  • It's a case of having to spawn the UI into memory. Again, compressing the texture assets and reducing its memory footprint will improve things.

    Since the lag occurs when the UI is loaded for the first time, it may be preferable to preload it ahead of the game beginning by calling the Menu's LoadUnityUI function manually in your first scene to force the spawning of the UI. To do that, place this script on a GameObject and use the Object: Call event Action to trigger its PreloadMenu function.

    using UnityEngine;
    
    public class MenuPreloader : MonoBehaviour
    {
    
        public string menuName;
    
        public void PreloadMenu ()
        {
            AC.PlayerMenus.GetMenuWithName (menuName).LoadUnityUI ();
        }
    
    }
    
  • I tried this but unfortunately it hasn't stopped the issue. plus, compressing textures didn't help either...

  • It's not an issue related to AC specifically, but I will add the option to load UI prefabs by addressable in the next release, which should prevent frame-loss when spawning UI menus.

  • Cool, before I launch my demo I defo need to eradicate this from happening. There was no problem last week so i am not sure why this is now happening. And like I say, the pre load thing doesn't change anything.

  • It wouldn't be random, but I can't tell what you changed to make it happen.

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.