add file open
This commit is contained in:
24
Assets/3rd/DocumentHandler/Runtime/DocumentHandler.cs
Normal file
24
Assets/3rd/DocumentHandler/Runtime/DocumentHandler.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using UnityEngine;
|
||||
|
||||
namespace drstc.DocumentHandler
|
||||
{
|
||||
public class DocumentHandler : MonoBehaviour
|
||||
{
|
||||
#if UNITY_IPHONE && !UNITY_EDITOR
|
||||
[DllImport("__Internal")]
|
||||
internal static extern bool _OpenDocument(string path);
|
||||
|
||||
public static void OpenDocument(string path)
|
||||
{
|
||||
_OpenDocument(path);
|
||||
}
|
||||
#else
|
||||
public static void OpenDocument(string path)
|
||||
{
|
||||
Application.OpenURL("file:///" + path);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user