Skip to content

Instantly share code, notes, and snippets.

View hasanbayatme's full-sized avatar
❤️
Perceiving Love

Hasan Bayat hasanbayatme

❤️
Perceiving Love
View GitHub Profile
@hasanbayatme
hasanbayatme / Singleton.cs
Last active March 5, 2023 19:06
Best Singleton implementation in Unity, Combine it with preload scene pattern to achieve best implementation.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public abstract class Singleton<T> : MonoBehaviour where T : Component
{
#region Fields
/// <summary>
@hasanbayatme
hasanbayatme / Inventory.cs
Last active December 6, 2019 00:27
Learn how to make a inventory save and load using Save Game Pro.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using SaveGamePro;
public class Inventory : MonoBehaviour {
public struct Item {
public string name;
@hasanbayatme
hasanbayatme / ObjectSpawner.cs
Last active September 6, 2017 08:11
Learn how to save the runtime instantiated game objects.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using SaveGamePro;
public class ObjectSpawner : MonoBehaviour {
public GameObject prefab;
public Transform spawnPoint;
@hasanbayatme
hasanbayatme / RemoveChildren.cs
Last active September 1, 2017 09:15
Unity, Remove Game Object children in Runtime and Editor.
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class RemoveChildren : MonoBehaviour
{
void Start ()
{
@hasanbayatme
hasanbayatme / DrawLine2D.cs
Last active January 16, 2025 05:35
Unity (Game Engine) Line Drawing with mouse using Line Renderer. Useful for painting, drawing 2d physics lines.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class DrawLine2D : MonoBehaviour
{
[SerializeField]
protected LineRenderer m_LineRenderer;
[SerializeField]
@hasanbayatme
hasanbayatme / TransformExtensions.cs
Created July 31, 2017 16:20
Useful Unity (Game Engine) Transform Extensions, LookAt2D (Make the 2D object look at specified position), ...
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// Transform extensions.
/// Useful transform utilities and methods.
/// </summary>
public static class TransformExtensions
{
@hasanbayatme
hasanbayatme / DrawLine.cs
Last active August 8, 2024 22:48
Unity (Game Engine) Line Drawing with mouse using Line Renderer. Useful for painting, drawing 2d physics lines.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class DrawLine : MonoBehaviour
{
[SerializeField]
protected LineRenderer m_LineRenderer;
[SerializeField]
@hasanbayatme
hasanbayatme / README.md
Last active December 28, 2020 00:14
A Simple Bash Script for Installing Composer on Ubuntu Locally (current user) and Globally (all users).

Installation

Install composer locally (current user only):

wget -O - https://gist.github.com/EmpireWorld/1dd5f59566e186907f99dc16badc382a/raw/install-composer-local.sh | bash

Install composer globally (all users):

@hasanbayatme
hasanbayatme / README.md
Last active December 23, 2023 20:14
Easy to use Bash Script to Install LAMP stack on Ubuntu.

Installation

Automatic

Run the below command in terminal:

wget --no-cache -O - https://gist.github.com/EmpireWorld/737fbb9f403d4dd66dee1364d866ba7e/raw/install-lamp.sh | bash
@hasanbayatme
hasanbayatme / README.md
Last active January 10, 2021 20:14
Fixes Ubuntu broken packages. Accepts an argument to what action to apply to broken packages. you can use upgrade and install commands, default action is remove.

Fix Broken

This script allows you to fix the broken ubuntu packages.

Most of the time the broken packages will be fixed by removing them.

Getting Started Documentation License

Getting Started