Home > other >  scenes change in play mode and after i build the game on my phone the scenes does not change
scenes change in play mode and after i build the game on my phone the scenes does not change

Time:07-27

hi so i have a problem in unity so when am in the play mode inside of unity everything works fine but when i build my game on andriod and test it on my device its stuck on the first scene with the index 0 can anyone help me please am stuck with this for days this is the game manager script that am using

using System;
using UnityEngine;

using UnityEngine.SceneManagement;

namespace dotmob
{

    public partial class GameManager : Singleton<GameManager>
    {
        public static int TOTAL_GAME_COUNT
        {
            get => PrefManager.GetInt(nameof(TOTAL_GAME_COUNT));
            set => PrefManager.SetInt(nameof(TOTAL_GAME_COUNT),value);
        }

        public static LoadGameData LoadGameData { get; set; }


        protected override void OnInit()
        {
            base.OnInit();
            Application.targetFrameRate = 60;
        }
    }

    public partial class GameManager
    {
        // ReSharper disable once FlagArgument
        public static void LoadScene(int Num, bool showLoading = true, float loadingScreenSpeed = 5f)
        {
            var loadingPanel = SharedUIManager.LoadingPanel;
            if (showLoading && loadingPanel != null)
            {
                loadingPanel.Speed = loadingScreenSpeed;
                loadingPanel.Show(completed: () =>
                {
                    SceneManager.LoadScene(Num);
                    loadingPanel.Hide();
                });
            }
            else
            {
                SceneManager.LoadScene(Num);
            }
        }


        public static void LoadGame(LoadGameData data, bool showLoading = true, float loadingScreenSpeed = 1f)
        {
            LoadGameData = data;
            LoadScene(2, showLoading, loadingScreenSpeed);
        }

    }
}

public struct LoadGameData
{
    public GameMode GameMode { get; set; }
    public Level Level { get; set; }
}

CodePudding user response:

You can add Debug.logs in your code and check if your functions execute on your phone, to see mobile debugs enable Android logcat from package manager.

  • Related