Skip to content

Instantly share code, notes, and snippets.

View thnewlands's full-sized avatar

Holly Newlands thnewlands

View GitHub Profile
@aVolpe
aVolpe / Vibration.cs
Created October 16, 2014 02:45
Vibration for Unity3d with Android native Call, with fallback to Handlheld.Vibrate()
using UnityEngine;
using System.Collections;
public static class Vibration
{
#if UNITY_ANDROID && !UNITY_EDITOR
public static AndroidJavaClass unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
public static AndroidJavaObject currentActivity = unityPlayer.GetStatic<AndroidJavaObject>("currentActivity");
public static AndroidJavaObject vibrator = currentActivity.Call<AndroidJavaObject>("getSystemService", "vibrator");
@samsheffield
samsheffield / UnityCodingCheatSheet.txt
Last active November 13, 2024 10:12
Unity C# Cheat Sheet
// Unity C# Cheat Sheet
// I made these examples for students with prior exerience working with C# and Unity.
// Too much? Try Unity's very good tutorials to get up to speed: https://unity3d.com/learn/tutorials/topics/scripting
@keijiro
keijiro / AngleAxis3x3.hlsl
Last active July 28, 2024 18:35
3x3 Rotation matrix with an angle and an arbitrary vector
// Rotation with angle (in radians) and axis
float3x3 AngleAxis3x3(float angle, float3 axis)
{
float c, s;
sincos(angle, s, c);
float t = 1 - c;
float x = axis.x;
float y = axis.y;
float z = axis.z;
@t-mat
t-mat / 00README.md
Created October 24, 2018 12:59
[Unity] Replacement Shader for SceneView

This is an example code how to use replacement shader for SceneView.

  • Add this component to your Camera
  • Add some GameObject which has Cube as its prefix
  • Select TestReplacementShader/Enable Custom Render Mode on SceneView from Untiy Editor's main menu.
    • All Cube objects are drawn in red (replacement shader) in SceneView.
  • Select TestReplacementShader/Disable Custom Render Mode on SceneView from Untiy Editor's main menu.
    • All Cube objects are drawn in normal shader.
@frozenpandaman
frozenpandaman / travel-recs.md
Last active October 19, 2023 10:13
eli's travel recommendations

eli's travel recommendations

My recommendations for things to do – generally those that are interesting and/or delicious – in places I've lived or spent significant time. Enjoy!

Last updated October 18, 2023. Contact: @frozenpandaman

1. Japan

1.1. Tokyo

1.1.1. Food

@natowi
natowi / audio2midi.md
Last active November 1, 2024 06:36
List of open source audio to midi packages
Shader "Hidden/JumpFloodOutline"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
}
SubShader
{
Tags { "PreviewType" = "Plane" }
Cull Off ZWrite Off ZTest Always
1313
0313
1213
0213
1303
0303
1203
0203
1312
0312
@ArieLeo
ArieLeo / Usage.cs
Created November 7, 2021 09:38 — forked from Refsa/Usage.cs
DrawMeshInstancedIndirect with ShaderGraph and URP
using System.Collections.Generic;
using System.Runtime.InteropServices;
using UnityEngine;
class Render : MonoBehaviour
{
struct DrawData
{
public Vector3 Pos;
public Quaternion Rot;
@bgolus
bgolus / MobileVRHighlight.shader
Last active October 25, 2023 01:44
A mobile VR and MSAA friendly single object highlight shader using the stencil buffer
Shader "Mobile VR Highlight" {
Properties {
_ColorOutline ("Outline", Color) = (1,1,1,1)
_ColorInterior ("Interior", Color) = (0.25,0.25,0.25,0.25)
_ColorInteriorFaded ("Interior Faded", Color) = (0.1,0.1,0.1,0.1)
_ColorInteriorOcc ("Interior Occluded", Color) = (0.15,0.15,0.15,0.15)
_ColorInteriorOccFaded ("Interior Occluded Faded", Color) = (0.05,0.05,0.05,0.05)
_PulseRateMod ("Pulse Rate Modifier", Float) = 4.0
_OutlneWidth ("Outline Pixel Width", Float) = 1.0
}