Skip to content

Instantly share code, notes, and snippets.

View deprecatedcoder's full-sized avatar

Ryan Sullivan deprecatedcoder

View GitHub Profile
@IRCSS
IRCSS / SmoothGameCameraMovement.cs
Last active May 10, 2023 03:03
Unity Camera Movement in Game view like Scene View with filtering
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
// Moves Camera similar to how camera is moved in the Unity view port. Drop the scrip on the game object which has the camera and you wish to move.
public class SmoothGameCameraMovement : MonoBehaviour
{
public float lateralSpeed = 0.0015f;
@NBaron
NBaron / VariablesInUnityMonoBehaviour.cs
Created November 6, 2018 11:59
How to properly declare variables in a Unity component?
using System;
using UnityEngine;
namespace awesomeCompanyName.awesomeProductName.relevantNaming
{
public class MyComponent : MonoBehaviour
{
private OtherComponent _usedOnlyByMe;
[SerializeField]
@dpid
dpid / DiffuseColorWithLightEstimation.shader
Last active September 21, 2017 14:06
ARCore shader for Google Blocks materials in Unity
Shader "ARCore/DiffuseColorWithLightEstimation"
{
Properties
{
_Color("Color", Color) = (1,1,1,1)
_MainTex ("Base (RGB)", 2D) = "white" {}
}
SubShader
{
@ByronMayne
ByronMayne / AnimatedComponent.cs
Created May 29, 2017 11:17
The source code behind my Unity tip.
using UnityEngine;
using System.Collections;
// This is not need but I just wanted to make the point clear.
public class AnimatedComponent : MonoBehaviour
{
}
@WhiteNoise
WhiteNoise / MyVDPlugin.cs
Last active June 17, 2017 00:09
Unity Editor script for showing Virtual Desktop when Unity stops playing (for the HTC Vive). It allows you to stay in VR to edit code (without removing the headset).
using System;
using System.Collections;
using System.Reflection;
using System.Diagnostics;
using System.Runtime.InteropServices;
using UnityEditor;
using UnityEngine;
using System.Security;
@ipha
ipha / movement.cs
Last active December 30, 2016 23:22
using UnityEngine;
using System.Collections;
public class movement : MonoBehaviour {
const int numSamples = 10;
public GameObject head;
public float scalingFactor;
private Vector3 headPrev;
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public static class ListExtensions
{
public static T PickRandom<T>(this IList<T> source)
{
if (source.Count == 0)
return default(T);
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using System.IO;
public class SubmitFormOnline : MonoBehaviour {
public InputField textReference;
public string pendingDir;
// FormID comes from the google drive ID, eg:
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
using System.IO;
public class SaveFormToDisk : MonoBehaviour {
public InputField textReference;
public string saveDir;
public void SaveToFile(string text, string subDir) {
using UnityEngine;
using System.Collections;
public class LinkedCamera : MonoBehaviour {
// What transform to chase:
public Transform target;
// Debug keyboard controls:
public KeyCode modifier;
public KeyCode incSmooth;