Answer the question
In order to leave comments, you need to log in
How to get a reference to a Unity object (C#)?
Good afternoon. There is the following hierarchy: main/canvas/pages/navigationBar . The navigation bar includes a few more components. How to get a reference to it from a script from another class bound to another object? Thank you.
Answer the question
In order to leave comments, you need to log in
There are many options. The simplest is to do in another script where you need to get a link, SerializeField of type NavigationBar and drag the navigation bar there in the editor.
There are all sorts of options with singletons, GetComponent, FindObject and more. But Unity-way - described above.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question