Answer the question
In order to leave comments, you need to log in
How to read console in Unity2D using C# script?
Hello!
I decided to make an application on Unity2D (since I am already familiar with Unity and c #, and besides, I didn’t find a better option for my application), but I just can’t find how to read data from the console with a script.
Please tell me how to make it so that a c# script that is attached to one object writes something to the console (for example: 2c) and another c# script that is attached to another object reads data from the console and if it says 2c then perform a certain action.
Thanks in advance! :)
Answer the question
In order to leave comments, you need to log in
Unity doesn't have a console, but you can always use standard streams. However, it is important to note that your idea is completely stupid.
If you need a simple data exchange, create (for example, GameData) an object in the scene hierarchy and to it your own component (for example, DataRouter), which will store data in a public field / property for writing or reading (for example, List)
In your scripts, make a link (drag & drop ) or search:
You can also use the Singleton pattern.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question