Skip to content

n0tic/ByteVault-Library

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ByteVault-Library

My complete Library for unity. It is ever expanding.. meaning never done. (I usually strip it down for the games purpose to keep clutter away.) NOTE: Also, this repo is not up-to-date.

Bellow is an example of implementing one of the benefits

using Bytevaultstudio.Utils; // Include the library

public static Manager instance = null; // Reference the object

void Awake() => nUtils.CreateSingleton<Manager>(ref instance, this, this.gameObject); // Create a singleton.

Preview of the method used above + description of what it does.

public static void CreateSingleton<T>(ref T instance, T _this, GameObject obj)
{
    if (instance == null) instance = _this; // If there is no instance, set it to current instance.
    if (!EqualityComparer<T>.Default.Equals(instance, _this)) MonoBehaviour.Destroy(obj); // If this instance is a new instance, destroy object.

    MonoBehaviour.DontDestroyOnLoad(obj); // If this instance was not destroyed it should persist.
}

This includes a lot more stuff. I will add to this readme doc at a later time

About

My complete Library for unity. It is ever expanding.. (I usually strip it down for the games purpose)

Resources

License

Stars

Watchers

Forks

Languages