JS: Dictionary is not a generic definition error...

Hi to all!

Ive just started using generics, lists work fine, dictionaries give me this error code. Help would be great!

 var myDic : Dictionary.<String,int> = new Dictionary.<String,int>();`

import System.Collections.Generic;


var myDic = new Dictionary.<String,int>();

You should import the System.Collections.Generic namespace when using List too, since not everything is available without it.

If I paste your code into my project it works fine.

Do you have a syntax error (like a forgotten semi-colon) on the line above or something?

After a full reboot, the error doesn’t show up anymore. Same code… Had tried restarting unity, hadn’t worked. Thanks for the support! Does this kind of quirk happen often?