- Home /
typedefing in unity
I want to typedef a 2-dimensional Dictionary to a more readable type. Normally you would use
using MySQLDataTable= Dictionary<string, Dictionary<string, string>>;
but it seems that Unity doesn't support namespaces, causing the compile to fail with the following errors:
Assets/System/MySQL.cs(79,23): error CS0246: The type or namespace name `MySQLDataTable' could not be found. Are you missing a using directive or an assembly reference?
Assets/System/MySQL.cs(8,19): error CS0246: The type or namespace name Dictionary
2' could not be found. Are you missing a using directive or an assembly reference?
Is there any work around so I don't have to use variables types like
SortedDictionary<int, SortedDictionary<string, object>>
?
yes unity do not support namespaces. everything is defined in global namespace
Answer by Mike 3 · Mar 17, 2011 at 10:32 AM
You're missing the namespace for Dictionary (it won't parse it from another using statement, you have to add it manually when you're doing it the way you're trying)
This compiles fine for me:
using MySQLDataTable= System.Collections.Generic.Dictionary<string, System.Collections.Generic.Dictionary<string, string>>;