2021년 4학년 1학기 기업연계프로젝트2
컴퓨터소프트웨어공학과 <원광투어팀>
팀장 : 송유진
팀원 : 김나영, 이경희, 한유진
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
using UnityEngine;using System.Collections;using UnityEditor;using System;using System.Linq;using System.IO;
namespace Valve.VR{ public class SteamVR_CopyExampleInputFiles : Editor { public const string steamVRInputExampleJSONCopiedKey = "SteamVR_Input_CopiedExamples";
public const string exampleJSONFolderParent = "Input"; public const string exampleJSONFolderName = "ExampleJSON";
[UnityEditor.Callbacks.DidReloadScripts] private static void OnReloadScripts() { SteamVR_Input.CheckOldLocation(); CopyFiles(); }
public static void CopyFiles(bool force = false) { bool hasCopied = EditorPrefs.GetBool(steamVRInputExampleJSONCopiedKey, false); if (hasCopied == false || force == true) { string actionsFilePath = SteamVR_Input.GetActionsFilePath(); bool exists = File.Exists(actionsFilePath); if (exists == false) { string steamVRFolder = SteamVR.GetSteamVRFolderPath(); string exampleLocation = Path.Combine(steamVRFolder, exampleJSONFolderParent); string exampleFolderPath = Path.Combine(exampleLocation, exampleJSONFolderName);
string streamingAssetsPath = SteamVR_Input.GetActionsFileFolder();
string[] files = Directory.GetFiles(exampleFolderPath, "*.json"); foreach (string file in files) { string filename = Path.GetFileName(file);
string newPath = Path.Combine(streamingAssetsPath, filename);
try { File.Copy(file, newPath, false); Debug.Log("<b>[SteamVR]</b> Copied example input JSON to path: " + newPath); } catch { Debug.LogError("<b>[SteamVR]</b> Could not copy file: " + file + " to path: " + newPath); } }
EditorPrefs.SetBool(steamVRInputExampleJSONCopiedKey, true); } } } }}
|