프레임 수치 조절 스크립트 추가 및 디렉토리 경로 설정을 위한 스크립트 추가

- 윈도우에서 경로 설정 노출 팝업창 기능을 사용하기 위해 Project Settings > Other Settings > Configuration > Api Compatibility Level = .Net Framework로 변
This commit is contained in:
Mingu Kim
2025-12-10 17:48:43 +09:00
parent 71aed601dd
commit f0acbe21ad
11 changed files with 337 additions and 6 deletions

View File

@@ -0,0 +1,87 @@
using TMPro;
using UnityEngine;
public class DirectorySelect : MonoBehaviour
{
const string BASIC_DIRECTORY = "C://";
public string fileDirectory;
// OS별 기본 경로를 const 대신 static readonly 또는 private 필드로 정의
private static readonly string WINDOWS_DIRECTORY = "C:\\"; // Windows 경로는 이중 백슬래시를 사용하거나 @"C:\" 형태로 사용하는 것이 일반적입니다.
private static readonly string MAC_LINUX_DIRECTORY = "/Users/"; // macOS/Linux의 일반적인 사용자 홈 디렉토리 시작점
TMP_InputField inputDirectory;
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
inputDirectory = GetComponentInChildren<TMP_InputField>();
// OS에 맞는 기본 경로 설정
string basicDirectory = GetBasicDirectory();
inputDirectory.text = basicDirectory;
}
public void Search()
{
StandaloneFileBrowser.OpenFolderPanelAsync(
"폴더 선택", // 팝업 제목
"", // 기본 디렉토리
false, // 다중 폴더 선택 허용 여부 (false: 1개만 선택)
(string[] paths) => {
if (paths.Length > 0)
{
string selectedPath = paths[0];
Debug.Log("선택된 폴더 경로: " + selectedPath);
// TODO: 선택된 폴더 경로를 사용하여 로직 구현
}
else
{
Debug.Log("폴더 선택 취소됨.");
}
}
);
}
// Update is called once per frame
void Update()
{
}
/// <summary>
/// 현재 실행 환경의 OS에 맞는 기본 경로를 반환합니다.
/// </summary>
string GetBasicDirectory()
{
// Application.platform을 사용하여 현재 OS를 확인합니다.
// RuntimePlatform.OSXEditor, RuntimePlatform.OSXPlayer,
// RuntimePlatform.LinuxEditor, RuntimePlatform.LinuxPlayer 등 여러 플랫폼이 있습니다.
// macOS와 Linux는 파일 시스템 구조가 유사합니다 (슬래시 / 사용).
// 유니티 편집기(Editor)나 빌드된 플레이어(Player) 모두에서 확인 가능합니다.
if (Application.platform == RuntimePlatform.WindowsPlayer ||
Application.platform == RuntimePlatform.WindowsEditor)
{
// Windows
return WINDOWS_DIRECTORY;
}
else if (Application.platform == RuntimePlatform.OSXPlayer ||
Application.platform == RuntimePlatform.OSXEditor ||
Application.platform == RuntimePlatform.LinuxPlayer ||
Application.platform == RuntimePlatform.LinuxEditor)
{
// macOS (OSX) 및 Linux
return MAC_LINUX_DIRECTORY;
}
else
{
// 기타 플랫폼 (예: WebGL, Android, iOS)
// macOS/Linux와 동일한 경로를 기본값으로 사용하거나,
// 해당 플랫폼에 맞는 다른 경로를 반환할 수 있습니다.
return MAC_LINUX_DIRECTORY;
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 60ebf93c4e7b5469f80592685f22f30b

View File

@@ -0,0 +1,13 @@
using UnityEngine;
public class FrameCounter : MonoBehaviour
{
[SerializeField]
[Range(0, 120)]
int frame = 60;
void Start()
{
Application.targetFrameRate = frame;
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 42951d307a33b48fa96e3f52010a70e3