R
R
Roman2016-10-09 15:11:28
C++ / C#
Roman, 2016-10-09 15:11:28

How to call an array of strings that the user enters?

The user can click on the name of the array, so I get the name of the array, for example the name Products through gameObject.name, but how to display the Products array or the first word?
Something like this, but it doesn't work:

void OnClick(){
string []Products = {"prod1","prod2"}
string []SomeWords = this.gameObject.name;
string oneWord =SomeWords[1];
print(oneWord);
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
GavriKos, 2016-10-09
@GTech

Debug.Log(oneWorld) - logs the minimum level. There are also LogWarning and LogError.
Using the name of a gameObject is extremely bad practice.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question