Skip to content

Instantly share code, notes, and snippets.

View smkplus's full-sized avatar
😍
Curios

Seyed Morteza Kamali smkplus

😍
Curios
View GitHub Profile
@mattyellen
mattyellen / UnityAsyncOperationAwaiter.cs
Created July 26, 2020 19:36
Allows the use of async/await (instead of yield) with any Unity AsyncOperation
public static class ExtensionMethods
{
public static TaskAwaiter GetAwaiter(this AsyncOperation asyncOp)
{
var tcs = new TaskCompletionSource<object>();
asyncOp.completed += obj => { tcs.SetResult(null); };
return ((Task)tcs.Task).GetAwaiter();
}
}
@MagistrAVSH
MagistrAVSH / URP-VertexLit.shader
Last active March 28, 2024 22:06
UniversalRenderingPipeline VertexLit Shader
Shader "Universal Render Pipeline/Custom/VertexLit"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
_Gain ("Gain", Float) = 1.5
_Color ("Color", Color) = (1,1,1,1)
_EdgeColor ("Edge Color", Color) = (0,0,0,1)
[Toggle] _RemoveDiag("Remove diagonals", Float) = 0.
@tin2tin
tin2tin / Run_Script_in_PyConsole.py
Last active May 11, 2021 18:06
Run Script in the Python Console
bl_info = {
"name": "Run Script in PyConsole",
"author": "CoDEmanX",
"version": (1, 0),
"blender": (2, 80, 0),
"location": "Python Console &gt; Console &gt; Run Script",
"description": "Execute the code of a textblock within the python console.",
"warning": "",
"wiki_url": "",
"tracker_url": "",
@hizzlekizzle
hizzlekizzle / moire-resolve.glsl
Last active August 2, 2019 04:06
Moire mitigation shader code
#define moire_mitigation_factor 64.0
#define warpX 0.031
#define warpY 0.041
// Convert from linear to sRGB.
//float Srgb(float c){return(c<0.0031308?c*12.92:1.055*pow(c,0.41666)-0.055);}
vec4 Srgb(vec4 c){return pow(c, vec4(1.0 / 2.2));}
// Convert from sRGB to linear.
//float Linear(float c){return(c<=0.04045)?c/12.92:pow((c+0.055)/1.055,2.4);}
@hasanbayatme
hasanbayatme / MinMax.cs
Last active November 23, 2020 16:00
Unity Min Max Slider Implementation
using System;
using UnityEngine;
[Serializable]
public struct MinMax
{
[SerializeField]
private float min;
[SerializeField]
@mattatz
mattatz / Quaternion.hlsl
Last active May 14, 2024 21:22
Quaternion structure for HLSL
#ifndef __QUATERNION_INCLUDED__
#define __QUATERNION_INCLUDED__
#define QUATERNION_IDENTITY float4(0, 0, 0, 1)
#ifndef PI
#define PI 3.14159265359f
#endif
// Quaternion multiplication
@oliveratgithub
oliveratgithub / emojis.json
Last active July 21, 2024 14:56
Emoji-list with emojis, names, shortcodes, unicode and html entities [massive list]
{
"emojis": [
{"emoji": "👩‍👩‍👧‍👧", "name": "family: woman, woman, girl, girl", "shortname": ":woman_woman_girl_girl:", "unicode": "1F469 200D 1F469 200D 1F467 200D 1F467", "html": "&#128105;&zwj;&#128105;&zwj;&#128103;&zwj;&#128103;", "category": "People & Body (family)", "order": ""},
{"emoji": "👩‍👩‍👧‍👦", "name": "family: woman, woman, girl, boy", "shortname": ":woman_woman_girl_boy:", "unicode": "1F469 200D 1F469 200D 1F467 200D 1F466", "html": "&#128105;&zwj;&#128105;&zwj;&#128103;&zwj;&#128102;", "category": "People & Body (family)", "order": ""},
{"emoji": "👩‍👩‍👦‍👦", "name": "family: woman, woman, boy, boy", "shortname": ":woman_woman_boy_boy:", "unicode": "1F469 200D 1F469 200D 1F466 200D 1F466", "html": "&#128105;&zwj;&#128105;&zwj;&#128102;&zwj;&#128102;", "category": "People & Body (family)", "order": ""},
{"emoji": "👨‍👩‍👧‍👧", "name": "family: man, woman, girl, girl", "shortname": ":man_woman_girl_girl:", "unicode": "1F468 200D 1F469 200D 1F467 200D 1F467", "html": "&#128104;&zwj;&#128105;&z
@oviniciusfaria
oviniciusfaria / List Shuffle in C#
Last active October 21, 2023 12:16
List Shuffle in C# Unity 3D
public static void Shuffle<T>(this IList<T> ts)
{
var count = ts.Count;
var last = count - 1;
for (var i = 0; i < last; ++i)
{
var r = UnityEngine.Random.Range(i, count);
var tmp = ts[i];
ts[i] = ts[r];
ts[r] = tmp;
@louisvalet
louisvalet / Colors
Last active November 17, 2020 09:35
I heard you needed colors
using UnityEngine;
public static class Colors
{
public static readonly Color AbsoluteZero = new Color32( 0, 72, 186, 255 );
public static readonly Color Acajou = new Color32( 76, 47, 39, 255 );
public static readonly Color AcidGreen = new Color32( 176, 191, 26, 255 );
public static readonly Color Aero = new Color32( 124, 185, 232, 255 );
public static readonly Color AeroBlue = new Color32( 201, 255, 229, 255 );
public static readonly Color AfricanViolet = new Color32( 178, 132, 190, 255 );
@nnm-t
nnm-t / ConvertToSprite.cs
Last active July 20, 2024 09:24
Convert Texture2D To Sprite
using UnityEngine;
public static class ConvertToSpriteExtensiton
{
public static Sprite ConvertToSprite(this Texture2D texture)
{
return Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), Vector2.zero);
}
}