Hi, I am loading a level from a scene in my main menue with
Application.LoadLevel(name);
When the new scene is loaded, I get:
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
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.TreeGroupLeaf…cctor ()
Rethrow as TypeInitializationException: An
exception was thrown by the type
initializer for
TreeEditor.TreeGroupLeaf
It’s hard to find out what causes the exception. The scene loads and works but I want to find the Exception. Other scenes which I load don’t show the exception.
Non of myscripts call the GetLoalizedString and the scene is so big, i can’t remove all the objects to find the cause.
I also bound the event Application.logMessageReceived and the CallStack leads my to the TreeGroupRoot class from Unity with a path to theier buildserver.
For me the problem started after I updated to Unity5. After some trail and error it made sense that prefabs are the problem.
SOLUTION: I created a prefab prefTemp and placed all gameobjects in the scene inside it and deleted it from the scene. Added prefTemp to my scene again and the errors were gone.
The problem is really strange: The terran contains 5 Splat alphas which caused the problem. When I use another terrain (other terrain data) then the problem is gone. Weird.
The error only happens when you load from a scene with no trees to a scene with trees …well at least for me that is the case and this is the fix…for now
I have noticed this error once I started using Scenemanager.Loadscene( and recently renamed the level I was loading.
Whenever I loaded it, that same error message would show. In this scene. There used to be unity trees in the scene, I later replaced unity tree with my self modeled trees. However the trees remained in the project assets.
The solution that worked for me was to delete all Unity trees from the project assets and save the scene.
Many hours with this problem. I had to upgrade project from Unity4 to 5.3 and had the same error.
My SOLUTION: copy all prefab trees and apply their to terrain by editing.