こんにちは。
Unityにてテキストを読み込む処理を書いていたのですが、エラーが出て直せないため質問させていただきます。
現在原因不明です。
こちらがソースになります。
using System.Collections; using System.Collections.Generic; using UnityEngine; public class ReadingMusic : MonoBehaviour { private string[] textMessage; private string[,] textWords; private int rowLength; private int columnLength; private void Start() { TextAsset textasset = new TextAsset(); textasset = Resources.Load("TestText", typeof(TextAsset)) as TextAsset; string TextLines = textasset.text; textMessage = TextLines.Split('\n'); columnLength = textMessage[0].Split('\'').Length; rowLength = textMessage.Length; textWords = new string[rowLength, columnLength]; for (int i = 0; i < rowLength; i++) { string[] tempWords = textMessage[i].Split('\''); for (int n = 0; n < columnLength; n++) { textWords[i, n] = tempWords[n]; } } } }
そして、こちらがテキストになります。
1'A'5
よろしくお願いします。
追記:エラーメッセージ
IndexOutOfRangeException: Index was outside the bounds of the array.
ReadingMusic.Start () (at Assets/Scripts/ReadingMusic.cs:31)
回答1件
あなたの回答
tips
プレビュー