Skip to content

Instantly share code, notes, and snippets.

@nevarman
nevarman / ObjectPool
Last active August 29, 2015 14:21
Simple ObjectPool implementation for Unity3D with a ReorderableList editor, with extra features like adding elements to pool from prefabs folder easily.
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class ObjectPool : Singleton<ObjectPool>
{
public ObjectPoolElement[] objectPoolElements;
private List<string> enemyNames,pickupNames,fxNames,generalNames;
void Awake ()
// Shader for Unity integration with SpriteLamp
// Copyright (c) 2014 Steve Karolewics & Indreams Studios
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
@nevarman
nevarman / UnrealBuildSizeDecrease
Created June 20, 2015 10:59
Unreal build size decreasing tip
1)Open Project Launcher
2)Add new Custom Launch Profile (name what you like)
3)Project -> Navigate to your project.uproject
4)Build the first time (you can disable afterwards)
5)Cook for your texture of choice + localization (ex:en_US) and in additional cook options add the following: -clean -stage -pak -compressed -prereqs -distribution -nodebuginfo (as is)
@nevarman
nevarman / KinectInputModule
Created July 13, 2015 08:38
Kinect Hand Cursor for Unity3D
using UnityEngine;
using System.Collections;
using UnityEngine.EventSystems;
using System.Collections.Generic;
using Windows.Kinect;
/// <summary>
/// Kinect input module for UGUI, can track both hands for UI actions
/// Add this to your eventsystem gameobject and call TrackBody(...) method from your Kinect script
/// </summary>
[AddComponentMenu("Kinect/Kinect Input Module")]
@nevarman
nevarman / Deptmask.shader
Created August 28, 2015 08:58
Dept mask shader for Unity3d
Shader "Unlit/DeptMask" {
SubShader {
Tags {"Queue" = "Geometry+10" }
Lighting Off
ZTest LEqual
ZWrite On
ColorMask 0
Pass {}
}
@nevarman
nevarman / FillLinear.shader
Created September 28, 2015 15:13
Linear fill shader for Unity3D
Shader "Custom/Fill-Linear" {
Properties {
_MainTex ("Base (RGB)", 2D) = "white" {}
_Color ("Color", Color) = (1,1,1,1)
_Center ("Center", Vector) = (0,0,0,0)
_FillRate ("FillRate", Range(0, 1.0)) = 1.0
}
SubShader {
Tags { "RenderType"="Opaque" }
LOD 100
@nevarman
nevarman / FillRound.shader
Created September 28, 2015 15:13
Round fill shader for Unity3D
Shader "Custom/Fill-Round" {
Properties {
_MainTex ("Base (RGB)", 2D) = "white" {}
_Color ("Color", Color) = (1,1,1,1)
_Center ("Center", Vector) = (0,0,0,0)
_FillRate ("FillRate", Range(0.0, 1.0)) = 1.0
}
SubShader {
Tags { "RenderType"="Opaque" }
LOD 100
@nevarman
nevarman / GlassSublte.shader
Created December 15, 2015 15:19
FX Glass Sublte shader
// Per pixel bumped refraction.
// Uses a normal map to distort the image behind, and
// two additional textures to tint and highlight.
// ------
// Assembled by chance using a lot of freely available reference
// by Mauricio Perin aka @maperns for Aduge Studio/Zueira Digital
// game Qasir al-Wasat in a long series of try and error attempts
// during the years of 2011, 2012 ad 2015.
Shader "FX/Glass/Sublte" {
@nevarman
nevarman / Splat.shader
Created January 15, 2016 12:23
Splat effect shader like painting spill
Shader "Special/Splat"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
_NoiseTex ("Texture", 2D) = "white" {}
_Warp ("Warp", Range(0,1)) = 0
}
SubShader
{
@nevarman
nevarman / CommentAttribute.cs
Last active February 28, 2017 15:17
Comment Attribute for Unity Scripts. Add this attribute to top of first property in a class for a quick comment on Editor
using System;
using UnityEngine;
using System.Collections;
[AttributeUsage(AttributeTargets.Field, AllowMultiple = true)]
public class CommentAttribute : PropertyAttribute
{
/// <summary>
/// <para>The header text.</para>
/// </summary>
public readonly string comment;