I’m using Unity 2017.1.0f3 and MonoDevelop 5.9.6 and I recently updated the scripting runtime version from default (3.5) to 4.6.
Since then when I try to use a List or a Dictionary it doesn’t recognize them and mark them as error with the following message: “The name ‘List/Dictionary’ does not exist in current context”.
I can use other classes of the same namespace, like SortedDictionary without any problem, and the script works fine even using List or Dictionary but it’s annoying because it seems wrong and I can’t use autocomplete.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Test : MonoBehaviour {
// Update is called once per frame
void Update () {
var d = new Dictionary<string, string> (){
{ "test1", "Something here" },
{ "test2", "Something there" }
};
}
}
MonoDevelop probably didn’t get the memo that you updated the runtime version, and got confused.
Stop using MonoDevelop, it’s garbage. If that’s not an option, close Unity/MD, delete your .sln and .csproj files, open Unity, and then open scripts. That should fix things.
This. get VS Code, install the Unity and C# plugins as well as icon plugins, core sdk etc. Enjoy life with proper debugging, support and no more **** crashes. also you can copy and paste all the time into it, none of the horrible monodevelop bugs. Also its a fraction of the size and opens 4x faster.