Skip to content

Instantly share code, notes, and snippets.

View radiatoryang's full-sized avatar

Robert Yang radiatoryang

View GitHub Profile
@radiatoryang
radiatoryang / ConsoleEntry.prefab
Created December 15, 2015 03:53 — forked from LordNed/ConsoleEntry.prefab
HTC Vive in-vr Console Viewer. Add the ConsoleLogger script to a gameobject in your scene, and then the UIConsoleViewer to the controller or object you want the console to track. It has a somewhat complicated prefab setup so the prefabs have been attached at the end. I have no idea if you can distribute prefabs this way, so someone gets to find …
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &121470
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 4
m_Component:
- 224: {fileID: 22423080}
Shader "Custom/Gamma Image Effect" {
Properties
{
_MainTex ("Base (RGB)", 2D) = "white" {}
_SaturationAmount ("Saturation Amount", Range(0.0, 1.0)) = 1.0
_BrightnessAmount ("Brightness Amount", Range(0.0, 1.0)) = 1.0
_ContrastAmount ("Contrast Amount", Range(0.0,1.0)) = 1.0
}
SubShader
{
@radiatoryang
radiatoryang / BuildRadiator.cs
Last active April 14, 2024 22:33
This is my Unity Editor build script that I use for my games, to automatically build out players and package them in ZIP files.
using UnityEngine;
using UnityEditor;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.IO.Compression;
using Ionic.Zip; // this uses the Unity port of DotNetZip https://github.com/r2d2rigo/dotnetzip-for-unity
@radiatoryang
radiatoryang / DecentWater.shader
Last active September 26, 2015 22:09
a not-cheap but not-expensive water shader, decent quality DX9 2012-era water, by Robert Yang (@radiatoryang)
// a not-cheap but not-expensive water shader
// decent quality DX9 2012-era water, by Robert Yang (@radiatoryang)
// based on:
// built-in legacy Alpha-Bumped shader
// added cubemap reflection and rimlight stuff
// GlassStainedBumpDistort from Unity glass refraction demo
// http://forum.unity3d.com/threads/grabtexture-uv-correction-in-surface-shader.67742/
// ... this does NOT have fogging or edge blending (too expensive / annoying?)
using UnityEngine;
using System.Collections;
// place on a GameObject with an AudioSource component
[RequireComponent(typeof(AudioSource))]
public class PlayRandomSound : MonoBehaviour {
public AudioClip[] sounds; // assign in inspector
// Use this for initialization
@radiatoryang
radiatoryang / DemoSpreadsheet.cs
Created April 9, 2015 03:22
Unity C# code for grabbing a publicly published Google Docs spreadsheet
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
// usage: place on a UI Text object to visualize spreadsheet data
// preparing a Google Doc: make sure you go to File >> Publish... "Share" does NOT work for this
// publicly editable: https://docs.google.com/spreadsheets/d/1QDaGFXxh3zbVTcQKXygKZ67_EFXjUlGbHbK21ICvv-k/edit?usp=sharing
// view as HTML: https://docs.google.com/spreadsheets/d/1QDaGFXxh3zbVTcQKXygKZ67_EFXjUlGbHbK21ICvv-k/pubhtml
@radiatoryang
radiatoryang / DemoWebcam.cs
Created April 9, 2015 03:21
Unity C# code for grabbing a JPG (or PNG) off the internet and bringing into Unity
using UnityEngine;
using System.Collections;
// full reference: http://docs.unity3d.com/ScriptReference/WWW.html
// usage: place this on a gameObject with Mesh Filter and Mesh Renderer (e.g. a Quad, a Plane, a Cube)
// NOTE: this does NOT work in Web Player (browser security sandbox)
public class DemoWebcam : MonoBehaviour {
@radiatoryang
radiatoryang / ListDemo.cs
Created April 2, 2015 00:23
simple demo of lists and foreach for my Recursive Reality VR class, spring 2015
using UnityEngine;
using System.Collections;
using System.Collections.Generic; // STEP 1 OF USING A LIST: include this line
// a "List" is like an Array
// an array = "immutable", it cannot be resized
// a list = dynamically resizable, elastic, will stretch or shrink based on item count
// demo: I'm going to instantiate spheres, track the spheres using a list, and
// modify all of the spheres inside the list
@radiatoryang
radiatoryang / LookColorChange.cs
Last active April 23, 2017 07:44
simple script, use it with LookCast.cs
using UnityEngine;
using System.Collections;
// put this script on an object with a COLLIDER
public class LookColorChange : MonoBehaviour {
// ALL CODE IN "ONLOOK" WILL HAPPEN EVERY FRAME THIS THING IS LOOKED AT
void OnLook () {
// if we look in console, we should see this message
Debug.Log ("this thing is getting looked at!!!");
@radiatoryang
radiatoryang / LookCast.cs
Last active September 9, 2016 08:56
simple script for my Recursive Reality class to make things with
using UnityEngine;
using System.Collections;
// DIRECTIONS FOR USE:
// put this script on ForwardDirection gameObject in your Oculus camera rig
// it will automatically call a function named "functionToCallOnLook"
// on every script component on that object (the object needs a collider too)
public class LookCast : MonoBehaviour {