public void setsignal(int Signal_number, string chae_light)
{
// 파일 경로를 확인하고 필요한 경우 수정
string filePath = "Assets/test/situation.json";
// 데이터 클래스 가져오기
List<SignalData> jsondata_class = FileInStream.Instance.GetFile_SignalData();
// 데이터 업데이트
jsondata_class[Signal_number].signal = chae_light;
// JSON 문자열 생성
string json = JsonUtility.ToJson(jsondata_class);
// 파일에 데이터 저장
ApplyToFile(json, filePath);
}
private void ApplyToFile(string JSON, string File_path)
{
// 파일 존재 확인
if (!File.Exists(File_path))
{
File.Create(File_path);
}
// 파일에 데이터 쓰기
File.WriteAllText(File_path, JSON);
Debug.Log($"File saved: {File_path}");
}
바드형이 알려줌
답변이 더 있는데 절반만 퍼옴 ㅋㅋ