What I have below is so far so good, but is it okay to actually do this on any platform / OS?
Here’s the error I was getting : argumentexception: layertoname can only be called from the main thread.
and here’s what I did (I am just calling this static method via my class constructor)
public static string[] GetLayers(){
string[] ret = new string[32];
if (System.Threading.Thread.CurrentThread.ManagedThreadId == 1) {
for (int i = 0; i < ret.Length; i++) {
ret [i] = LayerMask.LayerToName (i);
}
}
return ret;
}
Thanks for your input.