store application.datapath on initialize #86
parent
686394c861
commit
265f88584b
|
@ -239,7 +239,7 @@ namespace Cysharp.Threading.Tasks.Internal
|
|||
}
|
||||
else
|
||||
{
|
||||
var fname = fi.FullName.Replace(Path.DirectorySeparatorChar, '/').Replace(Application.dataPath, "");
|
||||
var fname = fi.FullName.Replace(Path.DirectorySeparatorChar, '/').Replace(PlayerLoopHelper.ApplicationDataPath, "");
|
||||
var withAssetsPath = "Assets/" + fname;
|
||||
return "<a href=\"" + withAssetsPath + "\" line=\"" + line + "\">" + withAssetsPath + ":" + line + "</a>";
|
||||
}
|
||||
|
|
|
@ -92,8 +92,10 @@ namespace Cysharp.Threading.Tasks
|
|||
{
|
||||
public static SynchronizationContext UnitySynchronizationContext => unitySynchronizationContetext;
|
||||
public static int MainThreadId => mainThreadId;
|
||||
internal static string ApplicationDataPath => applicationDataPath;
|
||||
|
||||
static int mainThreadId;
|
||||
static string applicationDataPath;
|
||||
static SynchronizationContext unitySynchronizationContetext;
|
||||
static ContinuationQueue[] yielders;
|
||||
static PlayerLoopRunner[] runners;
|
||||
|
@ -177,6 +179,11 @@ namespace Cysharp.Threading.Tasks
|
|||
// capture default(unity) sync-context.
|
||||
unitySynchronizationContetext = SynchronizationContext.Current;
|
||||
mainThreadId = Thread.CurrentThread.ManagedThreadId;
|
||||
try
|
||||
{
|
||||
applicationDataPath = Application.dataPath;
|
||||
}
|
||||
catch { }
|
||||
|
||||
#if UNITY_EDITOR && UNITY_2019_3_OR_NEWER
|
||||
// When domain reload is disabled, re-initialization is required when entering play mode;
|
||||
|
|
|
@ -302,15 +302,25 @@ public class SandboxMain : MonoBehaviour
|
|||
return 10;
|
||||
}
|
||||
|
||||
async UniTask<int> Ex()
|
||||
{
|
||||
await UniTask.Yield();
|
||||
//throw new Exception();
|
||||
await UniTask.Delay(TimeSpan.FromSeconds(15));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void Start()
|
||||
{
|
||||
//_ = UniTask.Run(async () =>
|
||||
//{
|
||||
// var watch = System.Diagnostics.Stopwatch.StartNew();
|
||||
// await UniTask.Delay(new TimeSpan(0, 0, seconds: 10));
|
||||
// Debug.Log(watch.Elapsed);
|
||||
//});
|
||||
_ = Ex();
|
||||
|
||||
_ = UniTask.Run(async () =>
|
||||
{
|
||||
var watch = System.Diagnostics.Stopwatch.StartNew();
|
||||
await UniTask.Delay(new TimeSpan(0, 0, seconds: 10));
|
||||
Debug.Log(watch.Elapsed);
|
||||
});
|
||||
|
||||
//return;
|
||||
//await UniTask.SwitchToMainThread();
|
||||
|
|
Loading…
Reference in New Issue