Code Monkey home page Code Monkey logo

core-update-manager's Introduction

Core Update Manager

IMPORTANT NOTE: This branch is currently not under active development and is not considered to be suitable for production as-is. A greatly refactored version is currently being developed and battle-tested with a newer iteration of Grand Dad Mania: Revived and Know By Heart projects.

Core Update Manager is an optimized, extensible, garbage-free Update Manager for Unity.

First used for Grand Dad Mania Revived. If you're asking "why" then read this: https://blogs.unity3d.com/2015/12/23/1k-update-calls/

TL;DR: having magic methods called from Unity has a noticeable overhead with big amount of MonoBehaviours. If you wish to gain performance in this aspect or get more freedom/features at the expense of being a little more careful and using a little bit more memory, you can write your own Update Manager which will be the only thing that receives the magic Update method and distributes it across all the other objects. In Grand Dad Mania Revived we managed to save 0.5ms on average on Xiaomi Mi5S Plus.

While Unity is doubling-down on their Entity Component System paradigm, the usual MonoBehaviour approach is not going away, so this project can very well be useful to you. Managed updates will be faster than Unity's marshalled calls in almost any project.

How to install

Simply copy-paste https://github.com/Kolyasisan/Core-Update-Manager.git into Unity's Package Manager git field or create a local package folder manually. You can also import it directly into the project.

Quickstart

//Inherit from CoreMonoBeh
public class MyMonobeh : CoreMonoBeh
{
    //Create loop settings for this MonoBehaviour's CoreUpdate method
    public override void CoreInitSetup()
    {
        UpdateLoopSettings_CoreUpdate = UpdateLoopSettings.Create(this);
    }
    
    //These ones replace MonoBehaviour methods
    public override void CoreAwake() { }   
    public override void CoreStart() { }
    public override void CoreOnEnable() { }
    public override void CoreOnDisable() { }
    public override void CoreOnDestroy() { }
    
    //This method will be called according to the settings created in CoreInitSetup()
    public override void CoreUpdate() { }
    
    //Will not be called because the settings for these methods have not been created in CoreInitSetup()
    public override void CoreFixedUpdate() { }
    public override void CoreLateUpdate() { }
}

Read the wiki for instructions.

License

This project is distributed under the Beerware License
Beer

core-update-manager's People

Contributors

kolyasisan avatar meznaric 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.