Everyone knows that you can’t use new with MonoBehaviour.
What I am doing is put everything that doesn’t use the unity API inside another class then reference it. This left me with MonoBehaviours that uses only the other class. Is this the correct way to go.
Update
This time I had a problem with the integration tests. I have a code that goes like this.
class Foo : MonoBehavior{
public GameObject AGameObject{
get{ return bar.AGameObject}
set{ bar.AGameObject = value}
AnotherClass bar;
void Start(){
bar = new AnotherClass ();
}
}
I get when I use the Assertion Component:
Unexpected top level layout group! Missing GUILayout.EndScrollView/EndVertical/EndHorizontal?
UnityEditor.DockArea:OnGUI()
Any Help ?