D
D
destrix2020-07-05 21:26:34
C++ / C#
destrix, 2020-07-05 21:26:34

How to take a variable from another script in Unity?

Hello. In short, I have a scene in Unity, there are several objects on which there are scripts. I also have a main script on the cameras, which should use data from scripts on other objects. Help decide.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
Z
zZaKko, 2020-07-05
@destrix

In the camera script, throw a prefab on other objects and use GetComponent to take variables from them.

V
Vitaly, 2014-11-10
@vipuhoff

The path to the image can be obtained by calling the intent of the gallery, in which the image will still be selected and then returned in one of the intent parameters. That is, speaking in Russian, open a program in which the user selects a picture and get from it the path to this very picture. Or use directory listing via Directory.GetFiles, etc.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question