Skip to content

Instantly share code, notes, and snippets.

View nukadelic's full-sized avatar
☣️

Nukadelic nukadelic

☣️
View GitHub Profile
@Split82
Split82 / UnityShadersCheatSheet.shader
Created April 17, 2018 10:07
Unity Shaders Cheat Sheet
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)
@mattatz
mattatz / Quaternion.hlsl
Last active October 10, 2023 03:57
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
@solkar
solkar / BakeStaticCubemap.cs
Created July 17, 2017 13:24
Bake into Cubemap Unity Editor Script
/*
* This confidential and proprietary software may be used only as
* authorised by a licensing agreement from ARM Limited
* (C) COPYRIGHT 2014 ARM Limited
* ALL RIGHTS RESERVED
* The entire notice above must be reproduced on all authorised
* copies and copies may only be made to the extent permitted
* by a licensing agreement from ARM Limited.
*/
@tomkail
tomkail / ExtendedScriptableObjectDrawer.cs
Last active April 2, 2024 18:56
Displays the fields of a ScriptableObject in the inspector
// Developed by Tom Kail at Inkle
// Released under the MIT Licence as held at https://opensource.org/licenses/MIT
// Must be placed within a folder named "Editor"
using System;
using System.Reflection;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
@MattRix
MattRix / PhysicsFollower.cs
Last active October 1, 2023 03:22
A thing you can use to make a rigidbody move towards a position reliably
using UnityEngine;
using System.Collections;
using System;
[RequireComponent (typeof(Rigidbody))]
public class PhysicsFollower : MonoBehaviour
{
public Transform target;
Rigidbody rb;
@v01pe
v01pe / Example.cs
Last active November 14, 2022 18:03
A relative simple way to get the instance object from a custom property drawer that draws a serialized class inside a component
using UnityEngine;
using System.Collections;
public class Example : MonoBehaviour
{
public ExampleClass example;
void Start() {}
void Update() {}
}
@MattRix
MattRix / IsoSurface.cs
Last active October 12, 2021 02:48
Quick and dirty marching tetraheda isosurface thing
using UnityEngine;
using System.Collections;
using System;
using System.Collections.Generic;
[RequireComponent (typeof(MeshRenderer))]
[RequireComponent (typeof(MeshFilter))]
public class IsoSurface : MonoBehaviour
{
@mattatz
mattatz / LIC.shader
Last active April 3, 2022 14:09
Simple Line Integral Convolution shader for Unity.
Shader "Mattaz/LIC" {
Properties {
_VectorFieldTex ("Vector Field Texture", 2D) = "white" {}
_NoiseTex ("Noise Texture", 2D) = "white" {}
_FlowLength ("Flow Length", int) = 10
}
SubShader {
Tags { "RenderType"="Opaque" }
LOD 200
@Arakade
Arakade / gist:9dd844c2f9c10e97e3d0
Created January 3, 2015 16:54
Call from OnDrawGizmos() to draw text at Unity3D glocal position in Editor
static void drawString(string text, Vector3 worldPos, Color? colour = null) {
UnityEditor.Handles.BeginGUI();
if (colour.HasValue) GUI.color = colour.Value;
var view = UnityEditor.SceneView.currentDrawingSceneView;
Vector3 screenPos = view.camera.WorldToScreenPoint(worldPos);
Vector2 size = GUI.skin.label.CalcSize(new GUIContent(text));
GUI.Label(new Rect(screenPos.x - (size.x / 2), -screenPos.y + view.position.height + 4, size.x, size.y), text);
UnityEditor.Handles.EndGUI();
}
@MattRix
MattRix / MonoBehaviourInspector
Last active October 12, 2021 02:51
Allows you to use OnInspectorGUI in MonoBehaviour directly, rather than having to create a CustomEditor
using UnityEngine;
using UnityEditor;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
[CustomEditor (typeof(MonoBehaviour),true)]
[CanEditMultipleObjects]
public class MonoBehaviourInspector : Editor
{