/Hibzz.Hibernator

A library used to create low performant idle applications in Unity

Primary LanguageC#Creative Commons Attribution 4.0 InternationalCC-BY-4.0

Hibzz.Hibernator

LICENSE Twitter Follow Discord Unity C#

A library used to create low-performant idle applications in Unity

Without Hibernator

image

With Hibernator

image


Installation

Via NPM This package is published to the NPM registry, so users can install and get updates directly in the Unity Package Manager when the package is installed via NPM.

  • Navigate to the advanced project settings menu in the Unity Package Manager
  • Create a new scoped registry with the URL https://registry.npmjs.org
  • Add com.hibzz.hibernator as a scope
  • Now you'll be able to view and install the package under "My Registeries" in the Package Manager.

Via Github This package can be installed in the Unity Package Manager using the following git URL.

https://github.com/hibzzgames/Hibzz.Hibernator.git

Usage

Initializing the Hibernator

using Hibzz.Hibernator;

public class GameManager : MonoBehavior
{
    void start()
    {
        // Start the system
        Hibernator.Instance.Begin();

        // Optionally, you can specify render interval. Here, the screen is 
        // refreshed once every 15 seconds
        Hibernator.Instance.Begin(15.0f);
    }

    void OnDestroy()
    {
        // Stop the system
        Hibernator.Instance.Stop();
    }
}

Refreshing Graphics

using Hibzz.Hibernator;

public class RotateClass : MonoBehavior
{
    public float speed = 50.0f;

    void Update()
    {
        if(Input.GetKey(KeyCode.Space))
        {
            transform.Rotate(Vector3.up, speed * Time.DeltaTime);
            Hibernator.Instance.Refresh(); // Requests the graphics system to be updated
        }
    }
}

Optional Features

While refreshing the hibernator, users can optionally give a time and the system will keep refreshing for the given time. This time is scalable by Time.TimeScale.

// the hibernator will continue to run with max refresh rate for the next 4.5 seconds
Hibernator.Instance.Refresh(4.5f);

Have a question or want to contribute?

If you have any questions or want to contribute, feel free to join the Discord server or Twitter. I'm always looking for feedback and ways to improve this tool. Thanks!

Additionally, you can support the development of these open-source projects via GitHub Sponsors and gain early access to the projects.