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. Dismiss Notice

Question Fix UnityEditor.Experimental.UIElements compile errors in Unity 2019.4

Discussion in 'Scripting' started by parapsychic, Sep 23, 2020.

  1. parapsychic

    parapsychic

    Joined:
    Feb 15, 2016
    Posts:
    11
    [SOLVED]

    I am following the course "Create with Code" and I downloaded the assets to get started. However, I noticed a large number of compile errors. On looking closer, I found the the error to be in UnityEditor.Experimental.UIElements. My first guess was since this tutorial was made in 2018 version, this might've been moved out of Experimental stage. I looked up some documentation and it was indeed the problem. So, I started removing Experimental from all the lines. It worked and errors seemed to disappear one by one. But even after doing all that, the fix seems to be temporary as the old files kick in as soon as I [save] and close Unity. I know I am doing it wrong, so I need help on how to overcome this issue.
    I'm using Visual Studio Community 16.7.4 and Visual Studio Tools for Unity 4.7.0. I don't know if it's helpful. But extra info won't hurt ig.

    My unity version: 2019.4.10f17

    EDIT 2:
    As Brathnann said, going to Package Manager (Window > Package Manager), then changing Unity Registry to My Project and finally updating (click on the update to 2.2.2 on the lower right, I missed it at first. I'm dumb) Package Manager UI to 2.2.2 has seemed to solve the issue. Thank you Brathnann.

    EDIT:

    I've got like 125 of these compiler errors:

    Library\PackageCache\com.unity.package-manager-ui@2.0.7\Editor\AssemblyInfo.cs(7,12): error CS0246: The type or namespace name 'UxmlNamespacePrefixAttribute' could not be found (are you missing a using directive or an assembly reference?)


    And 16 of these warnings:

    Library\PackageCache\com.unity.package-manager-ui@2.0.7\Editor\Sources\UI\Common\Alert.cs(19,28): warning CS0109: The member 'Alert.UxmlFactory' does not hide an accessible member. The new keyword is not required.


    Screenshots:


     
    Last edited: Sep 24, 2020
  2. Brathnann

    Brathnann

    Joined:
    Aug 12, 2014
    Posts:
    7,144
    Great to provide more information, but you failed to provide a very key piece of info...a copy of the error you are getting. :)

    I would copy and paste an error and if you can, show the code related to the error. That's going to always be pretty helpful when trying to fix compile errors.
     
  3. parapsychic

    parapsychic

    Joined:
    Feb 15, 2016
    Posts:
    11
    Damn, I did miss that lol. I'll paste it here, and if possible, edit it out in the original post.
    I've got like 125 of these:

    Library\PackageCache\com.unity.package-manager-ui@2.0.7\Editor\AssemblyInfo.cs(7,12): error CS0246: The type or namespace name 'UxmlNamespacePrefixAttribute' could not be found (are you missing a using directive or an assembly reference?)


    And 16 of these:

    Library\PackageCache\com.unity.package-manager-ui@2.0.7\Editor\Sources\UI\Common\Alert.cs(19,28): warning CS0109: The member 'Alert.UxmlFactory' does not hide an accessible member. The new keyword is not required.


    Screenshots:
    upload_2020-9-23_21-32-45.png

    upload_2020-9-23_21-33-28.png
     

    Attached Files:

  4. Brathnann

    Brathnann

    Joined:
    Aug 12, 2014
    Posts:
    7,144
    Those errors seem to target the package manager ui, which does use UIElements. You may need to update your UIElements and your package manager ui packages.
     
  5. parapsychic

    parapsychic

    Joined:
    Feb 15, 2016
    Posts:
    11
    //EDIT:
    You were right! Thank you! I updated Package Manager UI to 2.2.2 and it all went away. I haven't tried running it with new code, but apparently it works. If this was reddit, I would've awarded you lol. Thank you!

    How do I do that? It's already up to date. And isn't the script (written?) for an older version of package manager? If what I understand is correct, then UI Elements is no longer Experimental as the script is trying to call. I could be wrong, I am a complete beginner.

    upload_2020-9-24_22-35-38.png



     

    Attached Files:

    Last edited: Sep 24, 2020
    Fibonaccov likes this.
  6. Brathnann

    Brathnann

    Joined:
    Aug 12, 2014
    Posts:
    7,144
    Glad it's fixed!
     
  7. Vinicius_Araujo

    Vinicius_Araujo

    Joined:
    Feb 23, 2020
    Posts:
    3
    For my Update this package resolve all the errors:
    upload_2022-4-5_19-57-51.png