Skip to content

Instantly share code, notes, and snippets.

using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
public unsafe class NetStandardPlus
{
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
public delegate void MyStdcallDelegate();
public static void Call(delegate*<void> action) => action();
@HiWill
HiWill / MaterialGradientDrawer.cs
Created August 27, 2021 02:36 — forked from totallyRonja/MaterialGradientDrawer.cs
A Material Property Drawer for the [Gradient] attribute which lets you edit gradients and adds them to the shader as textures. More information here: https://twitter.com/totallyRonja/status/1368704187580682240
using System;
using System.Collections.Generic;
using System.Linq;
using UnityEditor;
using UnityEngine;
using Object = UnityEngine.Object;
public class MaterialGradientDrawer : MaterialPropertyDrawer {
private int resolution;
@HiWill
HiWill / InvokeExtensions
Created January 11, 2019 16:07
MonoBehaviour_InvokeExtensions
using UnityEngine;
using System;
using System.Collections;
using System.Collections.Generic;
namespace Will
{
public static class InvokeExtensions
{
public static IEnumerator InvokeFrame(this MonoBehaviour monoBehavior, Action method, int frame = 1)
using UnityEngine;
using UnityEngine.Assertions;
using System.Linq;
using System.Collections.Generic;
using System.Collections.ObjectModel;
namespace SmartCombine {
public class SmartMeshData {
public Mesh mesh {get; private set;}
public Matrix4x4 transform {get; private set;}
Shader "Custom/GreyScaleForBackPlay" {
Properties
{
[PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {}
_Color ("Tint", Color) = (1,1,1,1)
[MaterialToggle] PixelSnap ("Pixel snap", Float) = 0
_EffectAmount ("Effect Amount", Range (0, 1)) = 1.0
}
SubShader
@HiWill
HiWill / NineSliceScaling.cs
Created August 24, 2016 07:44 — forked from mandarinx/NineSliceScaling.cs
9 slice scaling with a mesh in Unity3D
using UnityEngine;
// Nine slice scaling using a Mesh.
// Original code by Asher Vollmer
// https://twitter.com/AsherVo
// http://ashervollmer.tumblr.com
// Modifications by Thomas Viktil
// https://twitter.com/mandarinx
// http://ma.ndar.in/
@HiWill
HiWill / FSScrollController.cs
Created August 17, 2016 05:45 — forked from russianryebread/FSScrollController.cs
Inertial Scrolling for Unity 3D
using UnityEngine;
using System.Collections;
using Holoville.HOTween;
namespace FS.Handlers
{
public class FSScrollController : MonoBehaviour {
public float contentOverflowY = 0f;
public float contentHeight = 0f;
@HiWill
HiWill / SimpleGeo.cs
Created July 14, 2016 10:42 — forked from phosphoer/SimpleGeo.cs
Simple Geometry Painter for Unity
// The MIT License (MIT)
// Copyright (c) 2016 David Evans @phosphoer
// 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 furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
@HiWill
HiWill / MobileIllumVertexLit.shader
Created May 22, 2016 05:02 — forked from aras-p/MobileIllumVertexLit.shader
Simple Illuminated VertexLit shader
Shader "Mobile/Illum VertexLit" {
Properties {
_MainTex ("Base (RGB)", 2D) = "white" {}
_Illum ("Illum (RGB)", 2D) = "black" {}
}
SubShader {
Tags { "RenderType"="Opaque" }
LOD 80
Pass {
@HiWill
HiWill / SpotLight.shader
Created May 21, 2016 02:56 — forked from Yash-Kansagara/SpotLight.shader
Fake SpotLight Halo from a cylinder mesh(provided by Unity) with Shader.
Shader "Yash/SpotLight" {
Properties {
_Color("Main Color",Color) = (1,1,1,.5)
_Size("Size",Float) = 1
}
SubShader {
Tags { "Queue"="Transparent" "IgnoreProjector"="True" }
Blend One One
Pass