【Unity】データファイルの存在確認
2019/7/29一部修正
2019/7/31ロード中の処理を新しく追記しました。(追記2参照)
前回ロードするファイルが存在しない!とエラーが出たので、
ロードする前にファイルの存在を確認できるようにしてみます。
まずは、Google先生にお伺いを立てて…
System.IO.File.Existsなるものを見付けました。
早速、新規プロジェクトを作成して実験でっす。(^.^) オホホホ
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class GameManager : MonoBehaviour
{
private string FilePath = @"Test.csv";
// Start is called before the first frame update
void Start()
{
if (System.IO.File.Exists(FilePath) == false)
{
Debug.Log("ファイルなんか無いよ!");
}
else
{
Debug.Log("ファイル見っけ!");
…