Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

save a string as file to drive appscript

1
2
3
4
5
6
7
8
9
public class AsyncExample : MonoBehaviour
{
    async void Start()
    {
        Debug.Log("Waiting 1 second...");
        await Task.Delay(TimeSpan.FromSeconds(1));
        Debug.Log("Done!");
    }
}
Comment

save a string as file to drive appscript

1
2
3
4
5
6
7
    public static class AwaitExtensions
{
    public static TaskAwaiter GetAwaiter(this TimeSpan timeSpan)
    {
        return Task.Delay(timeSpan).GetAwaiter();
    }
}
Comment

save a string as file to drive appscript

1
2
3
4
5
6
7
public class AsyncExample : MonoBehaviour
{
    async void Start()
    {
        await TimeSpan.FromSeconds(1);
    }
}
Comment

save a string as file to drive appscript


public class AsyncExample : MonoBehaviour
{
    public async void Start()
    {
        // Wait one second
        await new WaitForSeconds(1.0f);
 
        // Wait for IEnumerator to complete
        await CustomCoroutineAsync();
 
        await LoadModelAsync();
 
        // You can also get the final yielded value from the coroutine
        var value = (string)(await CustomCoroutineWithReturnValue());
        // value is equal to "asdf" here
 
        // Open notepad and wait for the user to exit
        var returnCode = await Process.Start("notepad.exe");
 
        // Load another scene and wait for it to finish loading
        await SceneManager.LoadSceneAsync("scene2");
    }
 
    async Task LoadModelAsync()
    {
        var assetBundle = await GetAssetBundle("www.my-server.com/myfile");
        var prefab = await assetBundle.LoadAssetAsync<GameObject>("myasset");
        GameObject.Instantiate(prefab);
        assetBundle.Unload(false);
    }
 
    async Task<AssetBundle> GetAssetBundle(string url)
    {
        return (await new WWW(url)).assetBundle
    }
 
    IEnumerator CustomCoroutineAsync()
    {
        yield return new WaitForSeconds(1.0f);
    }
 
    IEnumerator CustomCoroutineWithReturnValue()
    {
        yield return new WaitForSeconds(1.0f);
        yield return "asdf";
    }
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: csharp functions 
Csharp :: bunifu form fade transition c# 
Csharp :: windows forms link listbox to array 
Csharp :: C#$ 
Csharp :: Remove tabpage by key 
Csharp :: c# changimg to one decimal place 
Csharp :: CRUD configuration MVC with Firebase 
Csharp :: Cursor Invisibility 
Csharp :: scale curve revit api 
Csharp :: BOTON PARA CAMBIAR DE VIEW ASP.NET 
Csharp :: unity editor window mesh field 
Csharp :: c# is not 
Csharp :: c# replace foreach with lambda 
Csharp :: add integer to string c# 
Csharp :: postgres .net 6 datetime issue 
Csharp :: remove tag anchor and inside tag from html raw text c# 
Csharp :: Nested objects with linq expression 
Csharp :: unity how to get data of play session time in a text file? 
Csharp :: Prime number Upto n 
Csharp :: c# datagridview count value 
Csharp :: unity NetworkBehaviour the type or namespace could not be found 
Csharp :: unity on key press 
Csharp :: asp net core send email async 
Csharp :: unity add text to text field without deleting the old one 
Csharp :: webbrowser control feature_browser_emulation compatible 
Html :: html rupee symbol 
Html :: bootstrap text bold 
Html :: fontawesome phone icon 
Html :: Javascript getelementbyid hide element 
Html :: new tab in html 
ADD CONTENT
Topic
Content
Source link
Name
2+2 =