S
S
Sherck2017-05-12 09:48:10
Unity
Sherck, 2017-05-12 09:48:10

How to get string[] in unity for android app?

There is a list of string[] objects, getting via txt is not deprecated, via xml - too much effort to get one string. What is the best way to do it?
upd: is it possible somehow to store string[] in an empty GameObject, then in the game get a string from this object?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Daniil Basmanov, 2017-05-12
@Sherck

To store data in the unit there is a ScriptableObject :

using UnityEngine;

[CreateAssetMenu]
public class Config : ScriptableObject
{
    public string[] strings;
}

You can create an object through code using ScriptableObject.CreateInstance or through the menu.
Then you can link it in the inspector or load it from resources as you prefer.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question