This is copy-paste of problem:
UnityException: You are not allowed to call this function when declaring a variable.
Move it to the line after without a variable declaration.
If you are using C# don't use this function in the constructor or field initializers, Instead move initialization to the Awake or Start function.
WorldManager..ctor ()
GameManager..ctor ()
I googled this and really its not real problem as you can delete and paste script as new (i think i’ve done that before) BUT some say this can be fixed. Solution was given but I don’t understand it at all.
This is copy-paste of solution:
The problem is you're trying to invoke the Unity API from a thread other than the main thread, which is not allowed.
Constructor calls and field initialization for MonoBehaviours occur on the loading thread. Your Constraint class constructor is called, which calls setPartRef(), which calls GameObject.Find() - there's the Unity API on the loading thread.
If your Constraint is intended to be a MonoBehaviour, move the call to setPartRef() from the constructor to the Start() function. If it's not intended to be a MonoBehaviour, make sure it gets new'd from within the Awake() or Start() of a MonoBehaviour, not within a MonoBehaviour's field initialization. (Hint: do you have a MonoBehaviour that has a field of type Constraint?)
I can send copy of script if needed.