Skip to content

Instantly share code, notes, and snippets.

View Legogo's full-sized avatar

André Berlemont Legogo

View GitHub Profile
@Legogo
Legogo / ScreenshotManager
Last active May 31, 2023 12:21
Take a screenshot into a png file
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
using System.IO;
/// <summary>
/// https://answers.unity.com/questions/12070/capture-rendered-scene-to-png-with-background-tran.html
/// </summary>
@Legogo
Legogo / EnumState.cs
Created November 15, 2021 18:32
State manager using generic enums
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// https://docs.microsoft.com/fr-fr/dotnet/csharp/language-reference/operators/user-defined-conversion-operators
/// </summary>
[System.Serializable]
public class EnumState<TState> where TState : System.Enum
{
@Legogo
Legogo / FpsControl.cs
Created August 22, 2018 11:44
Yet another FPS controller simple script
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class FpsControl : MonoBehaviour {
protected Vector2 frame_mouse_position;
public Transform h;
public Transform v;
@Legogo
Legogo / VersionManager.cs
Last active April 4, 2019 07:38
Add a menu to manage version in BuildSettings
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#endif
/// <summary>
/// author : ab
@Legogo
Legogo / PathFinder.cs
Created March 14, 2018 23:12
Unity hand made pathfinding work
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
using UnityEditor;
public class PathFinder : MonoBehaviour {
public List<PathFinderNode> nodes = new List<PathFinderNode>();
@Legogo
Legogo / EditorTypeIconDrawer.cs
Created January 31, 2018 14:47
Draw icon next to object that have a specific component. Must be matching a [editor data]/icons/icon_[Type].png as first child (after Transform).
using UnityEngine;
using UnityEditor;
using System;
using System.Collections.Generic;
[InitializeOnLoad]
public class EditorTypeIconDrawer
{
private static Dictionary<Type,Texture> icons;
@Legogo
Legogo / Framerate.cs
Last active April 26, 2018 17:13
Simple FPS experimentations for unity framerate FPS / vsync
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
///
/// https://docs.unity3d.com/ScriptReference/Application-targetFrameRate.html
///
/// On standalone platforms the default frame rate is maximum achievable frame rate.
///
@Legogo
Legogo / PlaneFader.cs
Last active May 15, 2017 11:22
To have a way to fade in/out the screen with a color (u5.6)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
/// <summary>
/// Author : https://gist.github.com/Legogo
/// 2017-05-15
/// </summary>
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System;
public class CallbackManager {
public class CallbackCategory {
public string name = "";
public List<CallbackInfo> infos;
@Legogo
Legogo / TwitterApi.cs
Last active May 15, 2017 11:19
Unity3d Twitter search (using apps account)
using UnityEngine;
using System;
using System.Security.Cryptography;
using System.Collections.Generic;
using System.Text;
using System.Globalization;
using System.Collections;
using MiniJSON;
/*