initial commit
This commit is contained in:
parent
6715289efe
commit
788c3389af
37645 changed files with 2526849 additions and 80 deletions
|
@ -0,0 +1,38 @@
|
|||
#if !UNITY_EDITOR && (UNITY_ANDROID || UNITY_WEBGL)
|
||||
#define READ_STREMAING_ASSETS_WITH_WEB_REQUEST
|
||||
#endif
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
#if READ_STREMAING_ASSETS_WITH_WEB_REQUEST
|
||||
using Unity.Services.Core.Internal;
|
||||
#endif
|
||||
|
||||
namespace Unity.Services.Core.Configuration
|
||||
{
|
||||
static class StreamingAssetsUtils
|
||||
{
|
||||
public static Task<string> GetFileTextFromStreamingAssetsAsync(string path)
|
||||
{
|
||||
var fullPath = Path.Combine(Application.streamingAssetsPath, path);
|
||||
#if READ_STREMAING_ASSETS_WITH_WEB_REQUEST
|
||||
return UnityWebRequestUtils.GetTextAsync(fullPath);
|
||||
#else
|
||||
var completionSource = new TaskCompletionSource<string>();
|
||||
try
|
||||
{
|
||||
var fileText = File.ReadAllText(fullPath);
|
||||
completionSource.SetResult(fileText);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
completionSource.SetException(e);
|
||||
}
|
||||
|
||||
return completionSource.Task;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 3fefd9c9a0e33734aba3b2fc03b44585
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
Add table
Add a link
Reference in a new issue