0

I am writting test cases for a Unity Project. I wanted to create a instance of a Monobehaviour class.

Problem: Null value when I am trying to find game object with the tag.

Code:

[UnityTest]
public IEnumerator DummyTestWithEnumeratorPasses() {
    GameObject  dummyController = GameObject.FindWithTag("dummyControllerTag");
    Debug.Log (dummyController);  // Null always.
    yield return null;
}

Snapshot:

enter image description here

EDIT:

After the comments, here is my new code that matches the tag name:

[UnityTest]
public IEnumerator DummyTestWithEnumeratorPasses() {
    GameObject  CUIController = GameObject.FindWithTag("CUIControllerTag");
    Debug.Log (CUIController);  // Null always.
    yield return null;
}
Programmer
  • 121,791
  • 22
  • 236
  • 328
Bhupesh Kumar
  • 369
  • 2
  • 18

0 Answers0