Search Unity

Build errors

Discussion in 'Scripting' started by Tohny123, Nov 27, 2020.

  1. Tohny123

    Tohny123

    Joined:
    Apr 24, 2019
    Posts:
    13
    UnityEditor.BuildPlayerWindow+BuildMethodException: 2 errors
    at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (UnityEditor.BuildPlayerOptions options) [0x0027c] in <9ddd600ae5964fe0b21a870e08c53748>:0
    at UnityEditor.BuildPlayerWindow.CallBuildMethods (System.Boolean askForBuildLocation, UnityEditor.BuildOptions defaultBuildOptions) [0x00080] in <9ddd600ae5964fe0b21a870e08c53748>:0
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr, Boolean&)

    What causes this issue
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,689
    Wait for it... Build errors!

    I take it this is for Android? If so, try exporting the project and building from Gradle.

    Another issue with Android (if that is what you're targeting) is the miserable Java-based toolchain. which also requires SDK license acceptance and everything else to be just so otherwise it uselessly throws a pout and fails. Make a fresh blank project, see if that can build. If that cannot build then at least you know it's a toolchain problem, NOT your own code.

    There might also be more-useful messages further up the console log.
     
  3. Tohny123

    Tohny123

    Joined:
    Apr 24, 2019
    Posts:
    13
    I fixed this issue by removing System.IO from my scripts, it's a bad solution though because i can't use file.delete to delete a save file, btw I'm building standalone.
    any thoughts
     
  4. Tohny123

    Tohny123

    Joined:
    Apr 24, 2019
    Posts:
    13
    the code causing the errors
    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. //using System.IO;
    4. using UnityEngine;
    5. using UnityEngine.Audio;
    6. using UnityEngine.UI;
    7. using UnityEngine.SceneManagement;
    8. public class SettingsMenu : MonoBehaviour
    9. {
    10.     public AudioMixer audmix;
    11.     Resolution[] resolutions;
    12.     public Dropdown resdropdown;
    13.     public Slider volslider;
    14.     public Slider sensitivityslider;
    15.     public GameObject areyousure;
    16.     public GameManager gameman;
    17.     public static SaveSystem savesys = new SaveSystem();
    18.     public string filename;
    19.     public float rotspeed;
    20.     public Dropdown graphicsdropdown;
    21.  
    22.     void Start()
    23.     {
    24.         //load data
    25.         load();
    26.         //set rotationspeed
    27.         rotspeed = gameman.rotspd;
    28.         //set volume to current volume
    29.         float tempvol;
    30.         audmix.GetFloat("Volume",out tempvol);
    31.         volslider.value = tempvol;
    32.         //if rotspeed is 0 set it to 8
    33.         if (rotspeed <= 0)
    34.         {
    35.             sensitivityslider.value = 8;
    36.             gameman.rotspd = 8;
    37.             rotspeed = 8;
    38.             SaveSystem.Save(gameman, filename);
    39.         }
    40.         else
    41.         {
    42.             sensitivityslider.value = rotspeed;
    43.         }
    44.         //set dropdown to screen resolutions
    45.         resolutions = Screen.resolutions;
    46.         resdropdown.ClearOptions();
    47.         List<string> resoptions = new List<string>();
    48.         int curresindex = 0;
    49.         for (int i = 0; i < resolutions.Length; i++)
    50.         {
    51.             string options = resolutions[i].width + "x" + resolutions[i].height;
    52.             resoptions.Add(options);
    53.  
    54.             if (resolutions[i].width == Screen.currentResolution.width &&
    55.             resolutions[i].height == Screen.currentResolution.height)
    56.             {
    57.                 curresindex = i;
    58.             }
    59.         }
    60.         resdropdown.AddOptions(resoptions);
    61.         resdropdown.value = curresindex;
    62.         resdropdown.RefreshShownValue();
    63.         //quality settings value
    64.         graphicsdropdown.value = QualitySettings.GetQualityLevel();
    65.         //set are you sere message to false
    66.         areyousure.SetActive(false);
    67.  
    68.     }
    69.     //enable are you sure
    70.     public void activateareyousure ()
    71.     {
    72.         areyousure.SetActive(true);
    73.     }
    74.     //delete save
    75.     public void savedelyes()
    76.     {
    77.         string path = Application.persistentDataPath + filename;
    78.         //File.Delete(path);
    79.        // UnityEditor.AssetDatabase.Refresh();
    80.         SceneManager.LoadScene("Options");
    81.     }
    82.     //close are you sure
    83.     public void savedelno()
    84.     {
    85.         areyousure.SetActive(false);
    86.     }
    87.     //set volume
    88.     public void VolSet (float vol)
    89.     {
    90.         load();
    91.         gameman.volume = vol;
    92.         audmix.SetFloat("Volume", vol);
    93.         SaveSystem.Save(gameman, filename);
    94.     }
    95.     //set camspeed
    96.     public void CamSpeed(float rotatespeed)
    97.     {
    98.     load();
    99.     gameman.rotspd = rotatespeed;
    100.     SaveSystem.Save(gameman, filename);
    101.     }
    102.     //set quality
    103.     public void QualSet(int qualindex)
    104.     {
    105.         QualitySettings.SetQualityLevel(qualindex);
    106.     }
    107.     //set fullscreen
    108.     public void Fullscreenset(bool isfullscrn)
    109.     {
    110.         Screen.fullScreen = isfullscrn;
    111.         gameman.fullscreen = isfullscrn;
    112.         SaveSystem.Save(gameman, filename);
    113.     }
    114.     //set resolutions
    115.     public void ResSet(int resindex)
    116.     {
    117.         Resolution res = resolutions[resindex];
    118.         Screen.SetResolution(res.width, res.height, Screen.fullScreen);
    119.     }
    120.     //load
    121.     public void load()
    122.     {
    123.     PlayerData plrdata = SaveSystem.Load(gameman, filename);
    124.     gameman.rotspd = plrdata.rotationspeed;
    125.     gameman.coinamount = plrdata.coinamount;
    126.     gameman.levelamount = plrdata.levelamount;
    127.     gameman.fullscreen = plrdata.fullscreen;
    128.     gameman.volume = plrdata.volume;
    129.     }
    130. }
    131.