- video link demonstrating the problem: Shown: problem, settings, code and logic quick screenshots:
- "Edit - Preferences - External Tools": what i changed here
- file - Build settings
- edit - project settings - player - publishing settings
- edit - project settings - player - other settings (not all)
- "Levels" button, script location
- level menu, all the scenes, lvl button's logic and it's code
- Other links are in the comments of this post becouse stackoverflow won't let me post more than 8 links in the reason of my low reputation. It must be here, unless this site shadow ban my links.
Caution: links at the top are marked with their serial numbers, which i will refer to in the text below.
To successfully build my unity project without any errors which i received earlier i followed guide from link N8. I checked boxes "custom base gradle template" and "custom gradle properties template" in "edit - project settings - player - publishing settings" (screenshot N10). Also i changed name of the "sdk/build-tools" some of it's versions file named "d8.bat" to "dx.bat" both at it's main foulder and "main/lib" foulder (screenshot N9). Also i changed baseProjectTemplate.gradle and gradleTemplate.properties in "project/Assets/Plugins/Android" (screenshot N11 and N12) after their appearance in this foulder after i checked the boxes in "edit - project settings - player - publishing settings" (screenshot N10). I also installed in android studio Android SDK settings ("Android studio - sdk manager (or "file - settings") - Appearance & Behaviour - System Settings - Android SDK") SDK platforms from android 25 to latest android and in SDK tools i installed Android SDK Build-Tools "25, 30, 31, 32 AND the latest version". These are the highlights. You can find the rest of what I did in the link N8, as i followed the instructions completely.
Description of the problem:
The game have a main menu where at the startup the only button "Levels" shows up. At press, main menu swithes to lvl menu where all the level buttons and a "Main menu" button. When one of these lvl buttons are pressed, the logic (screenshot N7) and code below will run (screenshot N7).
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class GoToLvlButton : MonoBehaviour{
public Object scene;
public void GoToSceneScene(){
SceneManager.LoadSceneAsync(scene.name);
};
};
In pc unity it works perfectly (video at N1) but when i build it (file - build settings - build), share my apk to my device (Huawei MediaPad M5 Lite 10 LTE "BAH2-L09", EMUI - 8.0.0, Android 8.0.0 (Oreo) API - 26), install and run it at this device, the "Levels" and "Main menu" buttons works fine, but when i click to other buttons in lvl menu, it clicks, but nothing happens.
All scenes already added to "file - build settings - Scenes in build" (screenshot N3).
I tried installing absolutely everything in "Android studio - sdk manager (or "file - settings") - Appearance & Behaviour - System Settings - Android SDK", but it didnt helped. I also several times completely reinstalled all unity hub and it's editors. I tried to install almost everything in additional installations in vs installing. I tried to install almost all modules to my 2022.3.4f1 unity engine. I watched a lot of tutorials, guides and even find two similar posts in two different sites (stackoverflow.com and unity.com), but they didn't helped me too. Tried to clear cache of my project. I tried to install other unity editor versions. I tried to change Minimum API Level and Target API Level to Android 8.0 'Oreo' (API level 26) (becouse it is my device android version) in "edit - project settings - player - other settings" (screenshot N5) but apk build fails no matter what i do.
I expected that when i run my game in my android device it will load scenes, as it do in pc, but it doesn't. My thoughts that problem in the script itself. I really need to run this game properly in my tablet, even if i need to recode all scripts. Thanks for reading.