Search Unity

Bug System.Collections data types missing from VS?

Discussion in 'Visual Scripting' started by jamie_unity411, Apr 20, 2023.

  1. jamie_unity411

    jamie_unity411

    Joined:
    Jun 20, 2022
    Posts:
    8
    Hello Unity Community.

    I've recently imported Visual Scripting into my project. I'm shocked to find that I can't make variables of List<T> type. The only options for Lists (in the fuzzy finder, and in the variable finder) are AOT lists.

    There's screenshot proof here that shows VS supported generic lists, and indeed Bolt supported it before Unity purchased it. Am I missing some import setting or has System.Collections been removed from VS? Any clues?

    Versions
    Unity 2021.3.11
    VS 1.7.8 (latest)
     
  2. jamie_unity411

    jamie_unity411

    Joined:
    Jun 20, 2022
    Posts:
    8
    Update for future googlers.

    Opening a new project and importing Visual Scripting does give me generic lists. So this problem local to my project specifically. Will investigate further.
     
  3. jamie_unity411

    jamie_unity411

    Joined:
    Jun 20, 2022
    Posts:
    8
    New update. This seems to be a problem with any project being switched to Android and regenerating units. This seems to be a Unity's VS issue
     
    Last edited: May 3, 2023
  4. PanthenEye

    PanthenEye

    Joined:
    Oct 14, 2013
    Posts:
    2,065
    System Collections are generic, and generic collections in UVS are AOT unsafe so they're filtered out by AOT Safe Mode based on platform/scripting backend selected. This is why AOT List that accepts any type was implemented. You're supposed to use that instead. Or hold the generic list in a C# script and operate with that since it's compiled at edit time and is AOT safe.

     
    Last edited: May 3, 2023
    sandsalamand likes this.
  5. jamie_unity411

    jamie_unity411

    Joined:
    Jun 20, 2022
    Posts:
    8
  6. PanthenEye

    PanthenEye

    Joined:
    Oct 14, 2013
    Posts:
    2,065
    It should be one of the checkboxes in Projects Settings/Visual Scripting or was it Preferences/Visual Scripting. One of those.

    Just note that if you want to use the generic collections in UVS variables with IL2CPP scripting backend, they won't work in builds. AOT safe mode is there for a reason.
     
    Last edited: May 4, 2023
    jamie_unity411 likes this.
  7. jamie_unity411

    jamie_unity411

    Joined:
    Jun 20, 2022
    Posts:
    8
    I understand. After some discussion it looks as though we will be rolling our own collections units to work around this.

    Thanks for your help. I will update this thread with a re-cap post for future googlers.
     
  8. A_Random_Stranger_Online_

    A_Random_Stranger_Online_

    Joined:
    Jul 10, 2023
    Posts:
    4
    I have been trying to solve a problem for days. The problem is that my PC got reset and I downloaded all the game development softwares I needed like Unity Hub, Visual Studio, Blender, Aseprite, etc. But when I tried to code a player movement system I found out that the variable list is missing a lot of things like, Rigidbody, Gameobject, ParticleFX, etc. However, I still have basic data types like float, long, bool, int, etc. Any help is greatly appreciated.
     
  9. PanthenEye

    PanthenEye

    Joined:
    Oct 14, 2013
    Posts:
    2,065
    Use AoTList, it accepts any type and is supported on all platforms.
     
  10. A_Random_Stranger_Online_

    A_Random_Stranger_Online_

    Joined:
    Jul 10, 2023
    Posts:
    4
    thanks for your help but was able to fix it because in the setup i accidentally forgot to install the github copilot and the intellisense system thing but now it works