Skip to content

Instantly share code, notes, and snippets.

@keiranlovett
keiranlovett / unity: underwater
Created September 27, 2013 18:00
Attach to your main camera and key in the y-position of your water plane for "underwaterLevel". Leave "noSkybox" blank.
using UnityEngine;
using System.Collections;
public class Underwater : MonoBehaviour {
//This script enables underwater effects. Attach to main camera.
//Define variable
public int underwaterLevel = 7;
@keiranlovett
keiranlovett / unity: autofocus
Created September 27, 2013 17:58
Drop DoFAutoFocus onto your Camera, be sure you have imported the ImageEffects. Adjust your DoF Settings. Script creates a new Gameobject "DoFFocusTarget" and asigns it to your DoF Image Effect. Enable interpolateFocus to use linear interpolation for the focus point. Switch Quality between NORMAL and HIGH changes the focus call from the FixedUpd…
using UnityEngine;
using System.Collections;
using System;
/// <summary>
/// PlayFM
/// DoFAutofocus.cs
///
/// HIGH Quality checks every Frame
/// NORMAL Quality in Fixed Update
@keiranlovett
keiranlovett / unity: wind
Last active November 1, 2018 21:09
Custom Wind Script = random rotation around world.space
using UnityEngine;
using System.Collections;
public class windController : MonoBehaviour {
//TODO
//1) Inwards / Outwards Direction
float t;
int direction = 1; //Direction of rotation the wind object makes