Skip to content

Instantly share code, notes, and snippets.

View brenocogu's full-sized avatar
:shipit:
Game developer 🎮

Breno Willian brenocogu

:shipit:
Game developer 🎮
View GitHub Profile
@brenocogu
brenocogu / PoolHub.cs
Last active February 15, 2023 01:31
Pool hub is a simple way to create pools in runtime as you need them. Very useful to avoid Instantiate() and Destroy()
//Useful for generic pooling, autoincrement, creating pools. Everything Useful to pool
//I've made that for gameObjects but change it as you wish.
//Fell free to use it, you are awesome
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using System;
public struct PoolHub
{
@brenocogu
brenocogu / DataController.cs
Last active July 31, 2022 20:28
Useful Generic data serializer and loader
using System.IO;
using UnityEngine;
using System.Runtime.Serialization.Formatters.Binary;
using System;
using System.Collections.Generic;
/// <summary>
/// Quick tip: Don't use the '.' inside fileExt parameters (i.e. correct: 'exe' | incorrect: '.exe')
/// </summary>
public class DataController
@brenocogu
brenocogu / Singleton.cs
Last active September 26, 2022 12:01
Generic singleton class initialization for Non MonoBehaviours
using System;
/// <summary>
/// Non Monobehaviour Singleton Instance
/// </summary>
/// <typeparam name="T">Class to be Singleton</typeparam>
public class Singleton<T> where T : new()
{
private static Lazy<T> lazyInstance =
@brenocogu
brenocogu / MonoSingleton.cs
Last active December 20, 2022 18:38
[Unity3D] Generic singleton class initialization for MonoBehaviours
using UnityEngine;
using System;
using UnityEngine.SceneManagement;
/// <summary>
/// This class handles Singleton instance and managing. Just inherit from this and voyalla!
/// <para></para>
/// </summary>