Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Question Build error please help

Discussion in 'Editor & General Support' started by yominomimiya, Oct 23, 2023.

  1. yominomimiya

    yominomimiya

    Joined:
    Oct 23, 2023
    Posts:
    2
    Hi, i have a videogame class at school that is pretty fun where we use the unity version 2019.4.38f1
    And we have to make a build on pc of what we have this far to get our grade but every time i try to make it i get these errors
    upload_2023-10-23_15-38-31.png
    And the teacher hasn't gotten back to me to explain to me what is going on :(
     

    Attached Files:

  2. spiney199

    spiney199

    Joined:
    Feb 11, 2021
    Posts:
    8,408
    What the errors mean is, when you go to build, the specified code is not available. This is due to stuff like conditional compilation, which includes/excludes code based on certain circumstances. The main one being either operating in the editor, or in a build.

    These errors are a bit weird as this is coming out of Unity's own UI package, and not any of your code. Maybe in the Player settings turn off any code stripping?

    https://docs.unity3d.com/Manual/ManagedCodeStripping.html
     
    yominomimiya likes this.
  3. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    39,399
    Very true. One thing to note is that 2019 was where Unity removed ugui from Unity and added it back as a package.

    OP: you might want to try the package manager to remove
    com.unity.ugui
    (which may trigger a whole bunch of additional errors), then add it back in.
     
    yominomimiya and spiney199 like this.
  4. yominomimiya

    yominomimiya

    Joined:
    Oct 23, 2023
    Posts:
    2
    Thank you so much for trying to help! but it didn't do anything the errors are still there for some reason even when i removed and added com.unity.ugui and turned off the code stripping, this is really weird.
     
  5. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    6,974
    These package errors can sometimes also occur when a package version and the Unity editor version are incompatible. Check the package manager to see if there are any updates available to packages, specifically the ones causing issues, and upgrade those.

    Other than that you have two general options to try: upgrade to a newer editor version (2020.3) or create a new, empty project with your current editor version, make sure it does build without issues. Then export a .unitypackage of your scene(s) and include all dependent assets. Then import the .unitypackage to the new project, test that it works. You may have to restore project settings, either manually or by copying the given ProjectSettings/*.asset file to the new project. You may also have to install any missing packages in the package manager. But in the end it may be the way to get the project working again rather quickly, provided this transfer goes smoothly.