WORKING PERFECT ON EDITOR BUT NOT ON PHONE

My game works perfectly on unity editor. I have built it for android devices and uploaded the apk on google drive. Then i installedit on my android device. But some of codes are not working.

Whats not working is: I have two dropdowns which players can select fire color and character color. I save the values and text strings by using playerprefs When they select one. Then they press start button to load next scene. Character color is working good but fire effects are not being instantiated. The more interesting thing is that animation clips are not playing too when press button.

THIS IS IN FIRST SCENE

    void Start()
    {
        dropDownCharacter.onValueChanged.AddListener(delegate {
            OnMyValueChange01(dropDownCharacter);
        });

        dropDownFire.onValueChanged.AddListener(delegate {
            OnMyValueChange02(dropDownFire);
        });
    }

    private void OnMyValueChange01(Dropdown change)
    {
        PlayerPrefs.SetInt("characterInt", change.value);
        PlayerPrefs.SetString("characterString", change.options[change.value].text);
    }

    private void OnMyValueChange02(Dropdown change)
    {
        PlayerPrefs.SetInt("fireInt", change.value);
        PlayerPrefs.SetString("fireString", change.options[change.value].text);
    }

THIS IS IN SECOND SCENE

   private void StartGame()
    {
        characterInstance = (GameObject)Instantiate(theCharacter, Vector3.zero, Quaternion.identity);

        myGun = GameObject.FindWithTag("Gun");

        characterAnimator = GameObject.FindWithTag("Character").GetComponent<Animator>();
    }

    public void Fire() //FIRE BUTTON
    {
        if (!characterDied && ammo > 0)
        {
            ammo -= 1;

            characterAnimator.SetTrigger("isFire");

            fireEffectInstance = (GameObject)Instantiate(fireEffect, myGun.transform.position, fireEffect.transform.rotation);
        }
    }

    private void SetColors() // IN AWAKE METHOD
    {
        if (PlayerPrefs.GetString("characterString", "Blue Character") == "Blue Character")
        {
            theWitch = blueCharacter;
        }

        if (PlayerPrefs.GetString("characterString", "Blue Character") == "Pink Character")
        {
            theWitch = pinkCharacter;
        }

        if (PlayerPrefs.GetString("fireString", "Blue Fire") == "Blue Fire")
        {
            fireEffect = blueFire;
        }

        if (PlayerPrefs.GetString("fireString", "Blue Fire") == "Pink Fire")
        {
            fireEffect = pinkFire;
        }

        if (PlayerPrefs.GetString("fireString", "Blue Fire") == "Yellow Fire")
        {
            fireEffect = yellowFire;
        }

        if (PlayerPrefs.GetString("fireString", "Blue Fire") == "Purple Fire")
        {
            fireEffect = purpleFire;
        }

        if (PlayerPrefs.GetString("fireString", "Blue Fire") == "Green Fire")
        {
            fireEffect = greenFire;
        }
    }

noone even views the thread as usual…

These codes are working perfect on unity editor but when i built it for android and download on my phone via google drive, it doesn’t work.

For these types of issues do two things. First, check the player log on the mobile device for any errors. Maybe there are errors loading certain textures, maybe something else, no idea because “doesn’t work” doesn’t give enough information to guess.

Second add Debug.Log statements everywhere so you can track what is actually happening in your code. Then verify the code path is being followed as you expect it should. If not, that gives you something specific to investigate.

Hi @Joe-Censored thanks for reply, i don’t know how to check player log on mobile and i don’t know how to see debug.log messages from mobile.

I don’t get any errors or bugs on unity editor. The problem might be when i build it for android. I’m not that good on technical details.

Yeah if it works fine in the editor but not on Android, then the editor logs aren’t going to tell you anything. To view the log info, including Debug.Log, on Android you use logcat. More info:

1 Like

If you have a faulty code and open unity editor in unsafe mode, the firebase package disappears.
I realised that when I was comparing my previous working apk with the damaged one.
If you have a working one:

  1. Change the file type from fileNameWorking.apk to filenameWorking.zip.
  2. Then unzip and compare both fileNameWorking.zip and fileNameDamaged.zip.

There is a FirebaseCrashlytic.UnityPackage which may help.
Hope this works.