Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

I changed my target platform from android to windows then back to android and can't build anymore

Discussion in 'Android' started by emreyeni999, Apr 11, 2020.

  1. emreyeni999

    emreyeni999

    Joined:
    Jan 24, 2017
    Posts:
    7
    Hello, I been working on an android project for a long time and yesterday I had to do a quick test. I Didn't wanted to wait for long to build an .apk so I changed the target platform from android to windows, I built my project then changed it back to android. I'm not getting any errors while running the game inside unity editor but when try to build for android I get those errors.

    at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (UnityEditor.BuildPlayerOptions options) [0x0020e] in /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPlayerWindowBuildMethods.cs:181 errors 2.png
     
  2. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,682
    Did you check the script errors? What code is not compiling?
     
  3. emreyeni999

    emreyeni999

    Joined:
    Jan 24, 2017
    Posts:
    7
    It says that namespace "unityeditor" could not be found for my object equipping script. Should I remove it from script?

    UPDATE: I removed using.unityeditor and it works now
     
    Last edited: Apr 12, 2020
  4. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,682
    yes, you cannot use anything related to UnityEditor in player builds, you either need to put those scripts in Assets/Editor or wrap the code around #if UNITY_EDITOR #endif
     
    emreyeni999 likes this.