Interhaptics SDK for Unity 1.6
Loading...
Searching...
No Matches
Utility.cs
Go to the documentation of this file.
1using System.IO;
2using UnityEngine;
3using UnityEngine.Assertions;
4
5namespace UnityCoreHaptics {
6 public static class Utility
7 {
13 public static bool FileExists(string relativePath) {
14 var fullPath = Path.Combine(UnityEngine.Application.streamingAssetsPath, relativePath);
15 return File.Exists(fullPath);
16 }
17
23 public static void AssertFileExists(string relativePath) {
24 #if UNITY_EDITOR
25 try {
26 Assert.IsTrue(FileExists(relativePath));
27 }
28 catch {
29 throw new System.Exception(
30 "The relative path to file " + relativePath + " does."
31 + " Please check that this path is valid relative to Assets/StreamingAssets."
32 + " If this is your first time using this asset, please upload an AHAP file"
33 + " inside Assets/StreamingAssets/path/to/myfile.ahap and set AhapRelativePath to"
34 + " path/to/myfile.ahap"
35 );
36 }
37 #endif
38 }
39 }
40}