Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

Dictionarys supported or not?

Discussion in 'Project Tiny' started by furroy, Jun 9, 2019.

  1. furroy

    furroy

    Joined:
    Feb 24, 2017
    Posts:
    93
    Looking here: https://github.com/dotnet/corefx/bl...eLib/System/Collections/Generic/Dictionary.cs

    It sure seems like Dictionarys should work, but when I add anything even as simple as this:

    Code (CSharp):
    1. Dictionary<int, int> refsDict = new Dictionary<int, int>();
    I get:
    Code (CSharp):
    1. C:\Users\furroy\OneDrive\Documents\Krunk\Assets\Krunk\Scripts\TinyTileMapSystem.cs(40,57): error CS0246: The type or namespace name 'Dictionary<,>' could not be found (are you missing a using directive or an assembly reference?)
    2. *** Bee build failed (1.00 seconds), 11 items updated
    3.  
     
  2. etienne_unity

    etienne_unity

    Unity Technologies

    Joined:
    Aug 31, 2017
    Posts:
    102
    Hi @furroy

    Dictionaries are not supported in the Tiny subset of .Net we need to use to keep the code size as small as possible. As an alternative, you can use
    Unity.Collections.NativeHashMap
    .
     
  3. furroy

    furroy

    Joined:
    Feb 24, 2017
    Posts:
    93
    i thought that repo was the tiny .net core? why is there an implementation for Dictionary.cs in there if it's been removed?
     
  4. superpig

    superpig

    Drink more water! Unity Technologies

    Joined:
    Jan 16, 2011
    Posts:
    4,657
    No, that repo is the class library for .NET Core. It's not related to the C# profile used by Tiny.
     
    joncham likes this.
  5. Lucas-Meijer

    Lucas-Meijer

    Unity Technologies

    Joined:
    Nov 26, 2012
    Posts:
    175
    @furroy the best way to figure out what is in the tiny corlib profile today is:

    a) by using Editor-Dots.sln and going by what intellisense tells you
    b) by observing the code that you can find here: Editor\Library\DotsRuntimeBuild\artifacts\Stevedore\il2cpp\mscorlib