Skip to content

Instantly share code, notes, and snippets.

@pigeon6
pigeon6 / Unlit-CastShadow.shader
Created December 7, 2012 23:11
Unlit texture shader which casts shadow on Forward/Defered
// Unlit texture shader which casts shadow on Forward/Defered
Shader "Unlit/Texture CastShadow" {
Properties {
_MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
}
SubShader {
Tags {"Queue"="Opaque" }
LOD 100
@onevcat
onevcat / MonoSingleton.cs
Created July 18, 2013 00:37
Mono singleton Class. Extend this class to make singleton component.
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
/// <summary>
/// Mono singleton Class. Extend this class to make singleton component.
/// Example:
/// <code>
/// public class Foo : MonoSingleton<Foo>
/// </code>. To get the instance of Foo class, use <code>Foo.instance</code>
using UnityEngine;
using System;
using System.Text;
using System.Collections;
using System.Collections.Generic;
public class LSystemGenerator : MonoBehaviour
{
[Serializable]
@TarasOsiris
TarasOsiris / ShowToastUnityAndroid.cs
Created April 15, 2016 12:52
Shows toast on Android
public static void ShowToast(string text)
{
if (Application.platform == RuntimePlatform.Android)
{
AndroidJavaClass unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
AndroidJavaObject activity = unityPlayer.GetStatic<AndroidJavaObject>("currentActivity");
activity.Call("runOnUiThread", new AndroidJavaRunnable(
()=>
{
@Fonserbc
Fonserbc / SwipeInput.cs
Last active September 11, 2024 22:45
A simple swipe detector for touchscreens for Unity3D. Four cardinal directions.
using UnityEngine;
/*
* Swipe Input script for Unity by @fonserbc, free to use wherever
*
* Attack to a gameObject, check the static booleans to check if a swipe has been detected this frame
* Eg: if (SwipeInput.swipedRight) ...
*
*
*/
using System.Collections.Generic;
using System.Linq;
using UnityEditor;
using UnityEngine;
public class PoolPreparer : MonoBehaviour
{
[SerializeField]
PooledMonobehaviour[] prefabs;
@paullj
paullj / JSONEditor.cs
Last active October 16, 2020 08:57
A JSON Editor in the inspector. Preview and more information in comments 🙂
using System.IO;
using System.Linq;
using System.Globalization;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using UnityEngine;
using UnityEditor;
using System;
using UnityEngine;
using UnityEngine.EventSystems;
public class FixedButton : MonoBehaviour, IPointerUpHandler, IPointerDownHandler
{
[HideInInspector]
public bool Pressed;
// Use this for initialization
void Start()
anonymous
anonymous / PlayerPrefsTools.cs
Created March 13, 2018 08:08
Get all player prefs keys (windows only)
using System.Collections.Generic;
public class PlayerPrefsTools
{
public static void GetAllPlayerPrefKeys(ref List<string> keys)
{
if (keys != null)
{
keys.Clear();
}
@willchis
willchis / gist:9e14a49df26034d60141586308084d65
Last active December 7, 2020 19:40
Google Sheets API and Service Account
public class SpreadSheetConnector {
private string[] _scopes = { SheetsService.Scope.Spreadsheets }; // Change this if you're accessing Drive or Docs
private string _applicationName = "My Application Name from Google API Project ";
private string _spreadsheetId = "xdMsqBc3wblahblahblahblahkeygoeshere";
private SheetsService _sheetsService;
private void ConnectToGoogle() {
GoogleCredential credential;