GetLocalizedString can only be called from the main thread.
Constructors and field initializers will be executed from the loading thread when loading a scene.
Don't use this function in the constructor or field initializers, instead move initialization code to the Awake or Start function.
It dont tell what script making the error, but its clearly my script for loading scenes with buttons.
I got this error a couple of times after upgrading my project to Unity 5. Turns out I had trees I made from the tree creator in my scene. Once I removed them, the error went away.
Old reply, but I just had this problem. For me its caused by trees. I grabbed everything in the scene, put it under an empty game object, made a prefab from it. Deleted the prefab. Errors gone.
Same here. I’ve been making as much noise about it as I can for months and months without any reply from anyone at Unity. Is this ever going to be fixed?
ArgumentException: GetLocalizedString can only be called from the main thread.
Constructors and field initializers will be executed from the loading thread when loading a scene.
Don't use this function in the constructor or field initializers, instead move initialization code to the Awake or Start function.
TreeEditor.TreeGroupRoot..cctor ()
Rethrow as TypeInitializationException: An exception was thrown by the type initializer for TreeEditor.TreeGroupRoot
I tried the prefab trick and it worked, but it’d be a lot better if this issue just never came up again.
Actually no, it didn’t work. The first time it kind of did (my original terrain was still there though, just unchecked) but the second time (deleting the original terrain) it caused a bunch of other things to break in addition to the original errors showing up again. Something to do with it being a prefab I guess.
Just tried it. It worked the first time I hit play, but after that the errors return, so nope, it didn’t really work or I’m still missing something.
It’s a pain because any time I change scenes in play mode it pauses Unity so you can see the errors. When it’s running in the Rift I turn off the mouse cursor which makes it a bit tricky to hit the play button.
Just to keep you updated, we have seen the problem and someone reported a very useful incident which we can use to reproduce the issue. We will work on a solution to the problem, in the meantime please try the workaround posted by @FlyAnvil and let us know in the thread of the workaround if it works for you or not as it might help to solve the issue when we know more about the behaviour. You can follow the report and outcome here: Unity Issue Tracker - [SpeedTree] GetLocalizedString error messages when loading scene with trees
FWIW, i was having the same issue…And this worked… I deleted the trees from the scene and re-added them (luckily there position was not important)… and after doing that, the error is gone.
Also, in case it matters, i went as far as deleting the trees and re adding them (useing the “edit trees” button in the terrain editor). I then repainted the trees on the terrain.
@David-Berger The solution suggested by FlyAnvil didn’t work for me.
I just selected Edit Tree and Apply for each tree in the terrain; I didn’t try ev3d’s solution of deleting and repainting each tree, as I have too many in the scene to do that all again unless absolutely necessary.
Sorry, I’m missing something. Where are you clicking “edit tree” and “apply?” Are you clicking the tree prefabs in the project or is this something you’re doing in the scene hierarchy?
I’m using Terrain Composer which adds the trees to the terrain itself, so if this is something that has to be done directly on the trees in the Unity terrain editor, I’m not sure if I can solve the problem this way. If it’s just something I can fix by fiddling with the tree prefabs directly, that’d be great because I only have a few of them in my scenes. Wouldn’t take long at all to do.
Think I found it. Guess it doesn’t matter if I’m using Terrain Composer or not. The trees are there when I click the terrains in the hierarchy. However, when I click a tree and hit “edit trees” and then “edit tree” in the dropdown under that, I am not able to click “apply” on all of the trees. Some of them give the error “tree has already been selected as a prototype” as shown here. No idea what that means.
Ok, I hit “apply” on all the trees that didn’t give the error (some of those trees might not be in this scene, I seem to remember only using a few of them). It fixed it, but only for the first time that I pressed play. Once I stopped and ran it a second time, the errors returned.
So no, this has the same results as the original fix. Still broken for me.