This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class AxisInput : MonoBehaviour | |
{ | |
void Update() | |
{ | |
// Input Axis is a virtual joystick... unlike GetKey, it returns -1.0 - +1.0 | |
// e.g. holding your joystick to the left: -1.0f |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
using UnityEngine.VR; // you always need this to use special VR functions | |
public class VRUtility : MonoBehaviour { | |
// Use this for initialization | |
public void Start () { | |
// set render quality to 50%, sacrificing visual quality for higher FPS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Runtime.Serialization; | |
using System.Runtime.Serialization.Formatters.Binary; | |
using System.Reflection; | |
using System.Text; | |
using System.IO; | |
using UnityEngine; | |
using System.Collections; | |
using System.Collections.Generic; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Shader "Nature/Terrain/Diffuse" { | |
Properties { | |
[HideInInspector] _Control ("Control (RGBA)", 2D) = "red" {} | |
[HideInInspector] _Splat3 ("Layer 3 (A)", 2D) = "white" {} | |
[HideInInspector] _Splat2 ("Layer 2 (B)", 2D) = "white" {} | |
[HideInInspector] _Splat1 ("Layer 1 (G)", 2D) = "white" {} | |
[HideInInspector] _Splat0 ("Layer 0 (R)", 2D) = "white" {} | |
// used in fallback on old cards & base map | |
[HideInInspector] _MainTex ("BaseMap (RGB)", 2D) = "white" {} | |
[HideInInspector] _Color ("Main Color", Color) = (1,1,1,1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* copyright Robert Yang 2013 | |
use at your own risk | |
*/ | |
using UnityEngine; | |
using System.Collections; | |
using System.Collections.Generic; | |
public class GLShape : MonoBehaviour { // all-purpose interface for drawing stuff, PUT THIS ON YOUR CAMERA OBJECT | |
static Material lineMaterial; // init in Start() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// courtesy of Tale of Tales! | |
string WordWrap(string text, int lineLength) { | |
for (int i = lineLength; i < text.Length; i += lineLength) { | |
int returnSpot = text.LastIndexOf(" ", i); | |
if (returnSpot >= 0){ | |
text = text.Substring(0, returnSpot) + "\n" + text.Substring(returnSpot, text.Length-returnSpot); | |
i = returnSpot; | |
} | |
} | |
return text; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
// THIS CODE IS FULL OF ERRORS! DEBUG IT! | |
// 0) first, copy and paste this into a file in a Unity project | |
// 1) read the comments and variable names to figure out the coder's intention | |
// 2) go to the "Console" tab in Unity, look for stop sign icons -- these are code compile errors. | |
// the error will tell you the filename, then the line number and column, e.g. "GuessingGame.cs (8,100)" | |
// 3) double-click on an error in the Console to go to it in MonoDevelop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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!!!"); |