Change SetActive(true/false) from a GameObject which is child of a different ImageTarget

Hi there,

I have two Vuforia ImageTargets. One has a keyboard as a child. There is a c# script attached to the keyboard which checks if I type in the correct pin.

The other ImageTarget has two GameObjects as children. One is activated and the other one deactivated by default (SetActive(true/false).

My question is, how can access the SetActive() of these children from the script which is attached to the keyboard in the first ImageTarget? I want one GameObject two disappear and the other one to appear if I type in the correct Pin.

I already tried a lot with GetComponent to call a method in a second script attached two the second ImageTarget. But it always gives me errors about nullreferenceobject.

Do you guys have any kind of tipps or simple methods to solve this situation?

Thanks in advance!

An error NullReferenceException occurs when you are trying to do smth with a variable which equals null.
To solve the problem add a public or [SerializeField] when you announcing a variable like:

[SerializeField] GameObject gameObject;  //it`s better
//or
public GameObject gameObject;

Then, you should drag the gameObject in fitted field in inspector.

If I answered incorrect, please explain me my mistake.