Giter Club home page Giter Club logo

unity-coroutine-alternatives-benchmark's Introduction

Unity-Coroutine-Alternatives-Benchmark

benchmark of ways to "animate" in Unity

You will need https://assetstore.unity.com/packages/tools/animation/more-effective-coroutines-free-54975

benchmarks baseline, Update, Coroutine, above MEC Coroutine and 3 own implementations 2 of which use .NET Collections and 1 of which directly

Results:

coroutine benchmark results

winner:

my own implementation using my own data structure

That is this code: https://github.com/u-an-i/Unity-Coroutine-Alternatives-Benchmark/blob/main/Unity%20project/Assets/My/CoroutineReplacement2.cs
Usage: Put it on an active GameObject in your Scene, it is the manager. Use Timing.RunCoroutine optionally passing an int from 0 to 4 for a bin as the second parameter. The first parameter is your code which must now return an IEnumerator<float>. Use Timing.WaitForSeconds and Timing.KillCoroutines respectively, passing either the CoroutineHandle returned from Timing.RunCoroutine or the bin int passed to it to the latter to cancel the running coroutine early or to cancel all running coroutines of that bin early. Do not instruct to kill an already killed coroutine. Set CoroutineHandle.bin of a handle referencing a killed coroutine to null. Best do so at the end of your code in a coroutine too if you stored the handle returned from Timing.RunCoroutine.

takeaway:

Unity's Update is already very effective and moving 10,000 individual Updates to 1 single Update lets improve performance only by a rather very small amount.

note:

this project is made with Unity 2022.1 and uses its Standard built-in rendering pipeline.

unity-coroutine-alternatives-benchmark's People

Contributors

u-an-i avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.