반응형
- 코드 작성
using System.IO;
using UnityEngine;
public static class SystemPath
{
public static string GetPath(string fileName) //파일 위치 불러오기
{
string path = GetPath();
return Path.Combine(GetPath(), fileName);
}
public static string GetPath() //플랫폼 별 파일이 저장되는 위치 불러오기
{
string path = null;
switch (Application.platform)
{
case RuntimePlatform.Android:
path = Application.persistentDataPath;
path = path.Substring(0, path.LastIndexOf('/'));
return Path.Combine(Application.persistentDataPath, "Resources/");
case RuntimePlatform.IPhonePlayer:
case RuntimePlatform.OSXEditor:
case RuntimePlatform.OSXPlayer:
path = Application.persistentDataPath;
path = path.Substring(0, path.LastIndexOf('/'));
return Path.Combine(path, "Assets", "Resources/");
case RuntimePlatform.WindowsEditor:
path = Application.dataPath;
path = path.Substring(0, path.LastIndexOf('/'));
return Path.Combine(path, "Assets", "Resources/");
default:
path = Application.dataPath;
path = path.Substring(0, path.LastIndexOf('/'));
return Path.Combine(path, "Resources/");
}
}
}
반응형
'개발 > C#' 카테고리의 다른 글
유니티 C# 기즈모 Gizmo 간단 사용법 (0) | 2022.06.19 |
---|---|
유니티 C# 버튼 클릭 애니메이션 Button Click Animation 간단 사용법 (0) | 2022.06.19 |
유니티 C# 페이드 인 페이드아웃 Fade In, Fade Out 간단 사용법 (0) | 2022.06.19 |
유니티 C# 프레임 체크 Fps Check 간단 사용법 (0) | 2022.06.19 |
유니티 C# DontDestroyOnLoad 간단 사용법 (0) | 2022.06.19 |
유니티 C# 구글 로그인 Google Play Games GPGS 간단 구현 (0) | 2022.06.19 |
유니티 C# 싱글톤 패턴 Singleton Pattern 간단 사용법 (0) | 2022.06.19 |
유니티 C# 열거형 Enum 간단 사용법 (1) | 2022.06.19 |
댓글