###前提・実現したいこと
テキストアセットを読み込んでいるのですが、ファイルの内容がコンソールに出力されません。
ご教授のほどよろしくお願いします。
###該当のソースコード
C#
1 void Start () { 2 TextAsset sample = Resources.Load("Sample") as TextAsset; 3 string s = sample.text; 4 Debug.Log (s); 5 } 6
もちろん、テキストファイルには文字があり、保存されています。
読み込みエラーも起きてないので、読み込めているはずだと思うのですが。
下記のような出力となります。※1行目が空行の出力です。
UnityEngine.Debug:Log(Object) Sample:Start() (at Assets/Sample.cs:13)
###追記
C#
1 void Start () { 2 TextAsset sample = Resources.Load("Sample") as TextAsset; 3 Debug.Log (sample); 4 } 5
上記で試した所、下記のようなコンソールとなりました。
※1行目が空行の出力です。
UnityEngine.Debug:Log(Object) Sample:Start() (at Assets/Sample.cs:12)
TextAsset sample = Resources.Load("Sample") as TextAsset;
Debug.Log (sample);
こうだと何が出力されますか?
回答1件
あなたの回答
tips
プレビュー