[過去ログ] 【ゲームエンジン】Unityなんでも質問スレpart3 (1002レス)
前次1-
抽出解除 必死チェッカー(本家) (べ) 自ID レス栞 あぼーん

このスレッドは過去ログ倉庫に格納されています。
次スレ検索 歴削→次スレ 栞削→次スレ 過去ログメニュー
960
(1): 名前は開発中のものです。 [sage] 2021/04/19(月) 03:19:41.79 ID:9UmQ5f3w(1/3) AAS
配列の任意の文章をログに表示するのと画面にただ表示するのまでは分かったんですが
配列の一部をセリフとして呼び出すにはどう書けばいいでしょうか
今だとクリックした際にテキストデータをただ上から読むだけなので任意の文章をテキストから抜き出してセリフとして読み込むようにしたいです
961: 名前は開発中のものです。 [sage] 2021/04/19(月) 03:21:01.44 ID:9UmQ5f3w(2/3) AAS
public class NewBehaviourScript : MonoBehaviour
{
[SerializeField]
private Text dataText;

[SerializeField]
private TextAsset textAsset;

private string loadText2;
private string[] splitText2;

private int textNum2;//

// Start is called before the first frame update
void Start()
{

loadText2 = (Resources.Load("Test", typeof(TextAsset)) as TextAsset).text;
splitText2 = loadText2.Split(new string[] { "@br", "キ" }, System.StringSplitOptions.None);

textNum2 = 0;
dataText.text = "";

Debug.Log("現在の文章は" + splitText2[1] + "です");
}
962: 名前は開発中のものです。 [sage] 2021/04/19(月) 03:21:13.27 ID:9UmQ5f3w(3/3) AAS
// Update is called once per frame
void Update()
{
dataText.text = string.Format(splitText2[1]);

if (Input.GetButtonDown("Fire1"))
{ }
else if (Input.GetButtonDown("Fire3"))
{
if (splitText2[textNum2] != "")
{
dataText.text = splitText2[textNum2];
textNum2++;
if (textNum2 >= splitText2.Length)
{
textNum2 = 0;
Debug.Log(" o");
}
Debug.Log(" f");
}
else
{
dataText.text = "";
textNum2++;
Debug.Log("g");
}
Debug.Log(" y");

}
}
}
前次1-
スレ情報 赤レス抽出 画像レス抽出 歴の未読スレ AAサムネイル

ぬこの手 ぬこTOP 0.037s