Version: 2017.3

説明

指定されたパス文字列のファイル名や拡張子(ある場合)を返します

戻り値は最後のパスでのディレクトリ文字の後の文字を含みます。 もしパスの最後の文字がディレクトリセパレーター文字(/ など)である場合、空の文字列を戻り値とします。

using System.IO;
using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { void Start() { Debug.Log(Path.GetFileName("/Some/File/At/foo.extension")); } }