initial game submission
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
namespace UnityGLTF
|
||||
{
|
||||
public class AsyncCoroutineHelper : MonoBehaviour
|
||||
{
|
||||
public float BudgetPerFrameInSeconds = 0.01f;
|
||||
|
||||
private WaitForEndOfFrame _waitForEndOfFrame = new WaitForEndOfFrame();
|
||||
private float _timeout;
|
||||
|
||||
public async Task YieldOnTimeout()
|
||||
{
|
||||
if (Time.realtimeSinceStartup > _timeout)
|
||||
{
|
||||
await Task.Yield();
|
||||
_timeout = Time.realtimeSinceStartup + BudgetPerFrameInSeconds;
|
||||
}
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
_timeout = Time.realtimeSinceStartup + BudgetPerFrameInSeconds;
|
||||
|
||||
StartCoroutine(ResetFrameTimeout());
|
||||
}
|
||||
|
||||
private IEnumerator ResetFrameTimeout()
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
yield return _waitForEndOfFrame;
|
||||
_timeout = Time.realtimeSinceStartup + BudgetPerFrameInSeconds;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f51ceb82926c0a44394654b191b00336
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,18 @@
|
||||
#if UNITY_2017_1_OR_NEWER
|
||||
using System.Collections;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace UnityGLTF
|
||||
{
|
||||
public static class TaskExtensions
|
||||
{
|
||||
public static IEnumerator AsCoroutine(this Task task)
|
||||
{
|
||||
while (!task.IsCompleted)
|
||||
{
|
||||
yield return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7305b2a914e83c142b612e9994f1b483
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user