Skip to content

Instantly share code, notes, and snippets.

View nicoplv's full-sized avatar

Nicolas Pierre-Loti-Viaud nicoplv

View GitHub Profile
@alexanderameye
alexanderameye / CircularMenu.cs
Last active April 8, 2024 07:19
Circular menu for the Unity Editor
/*
MIT License
Copyright (c) [year] [fullname]
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@yasirkula
yasirkula / PaddingIgnoringImage.cs
Last active January 2, 2024 18:46
Modified version of Image component that ignores the sprite's padding in Unity
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Sprites;
using UnityEngine.UI;
#if UNITY_2017_4 || UNITY_2018_2_OR_NEWER
using UnityEngine.U2D;
#endif
#if UNITY_EDITOR
using UnityEditor;
@yasirkula
yasirkula / CustomMaxSizeSetter.cs
Created March 13, 2022 08:27
Set non-power-of-2 Max Size values for textures/sprites in Unity
using UnityEditor;
using UnityEngine;
public class CustomMaxSizeSetter : EditorWindow
{
private const int MINIMUM_MAX_SIZE = 32;
private const int MAXIMUM_MAX_SIZE = 2048;
private int initialMaxSize = -1;
private int currentMaxSize = -1;
@staggartcreations
staggartcreations / GlobalShaderParams.cs
Last active January 18, 2024 08:40
Component for passing values through Shader.SetGlobalXXX
using System;
using System.Collections.Generic;
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#endif
[ExecuteInEditMode]
public class GlobalShaderParams : MonoBehaviour
{
@LotteMakesStuff
LotteMakesStuff / InspectorButtonsTest.cs
Last active November 2, 2023 21:03
Code running pack! two property drawing scripts that make it super easy to trigger code via buttons in the inspector, and get feedback! [TestButton] draws you little buttons that call a method on your MonoBehaviour, and [ProgressBar] give you a great way to show feedback from long running methods. These are *super* helpful for things like proced…
using UnityEngine;
using System.Collections;
public class InspectorButtonsTest : MonoBehaviour
{
[TestButton("Generate world", "DoProcGen", isActiveInEditor = false)]
[TestButton("Clear world", "ClearWorld", 2, isActiveInEditor = false)]
[ProgressBar(hideWhenZero = true, label = "procGenFeedback")]
public float procgenProgress = -1;
@jringrose
jringrose / SceneHistoryWidget.cs
Last active May 5, 2024 13:19
Drop this into an Editor folder in your project to add a history widget to your scene view. Supports going backwards and forwards through your recent scene history, as well as a dropdown of all recently edited scenes. Also supports the back/forwards buttons on your mouse! Doesn't support multi-scene editing very well, though.
/*
MIT License
Copyright (c) 2016 Jesse Ringrose
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@Davidblkx
Davidblkx / LevenshteinDistance.cs
Created November 10, 2016 17:45
Levenshtein Distance in c#
using System;
namespace Algorithms
{
public static class LevenshteinDistance
{
/// <summary>
/// Calculate the difference between 2 strings using the Levenshtein distance algorithm
/// </summary>
/// <param name="source1">First string</param>
@hsandt
hsandt / buildandrun-ios.sh
Last active May 4, 2024 06:50
Build and run on a connected iOS device from command-line (even if Unity Editor does not support auto-run for current Xcode version)
# Platform: OS X
#
# Role: pull last repository changes, then build and run on a connected iOS device
#
# Usage: ./buildandrun-ios.sh [version] [--run-only]
#
# Parameters:
# version version number (e.g. "v0.2", "v4rc3", etc.) for your Unity build name
# --run-only set this if the Unity project was already build and you don't want to rebuild it
#
Shader "Name" {
Properties {
name ("display name", Range (min, max)) = number
name ("display name", Float) = number
name ("display name", Int) = number
name ("display name", Color) = (number,number,number,number)
name ("display name", Vector) = (number,number,number,number)