Skip to content

Instantly share code, notes, and snippets.

View ezonecom's full-sized avatar

Simon Edis ezonecom

View GitHub Profile
@yaeda
yaeda / AssetBundleSample.cs
Created April 18, 2013 07:30
Unity AssetBundle Examples.
using System;
using UnityEngine;
using System.Collections;
public class AssetBundleSample : MonoBehaviour {
public GUIText guitext;
// Use this for initialization
void Start () {
@bitbutter
bitbutter / TransparentBackgroundScreenshotRecorder.cs
Last active May 19, 2024 21:59
Rendering screenshots from Unity3d with transparent backgrounds
using UnityEngine;
using System.Collections;
using System.IO;
/*
Usage:
1. Attach this script to your chosen camera's game object.
2. Set that camera's Clear Flags field to Solid Color.
3. Use the inspector to set frameRate and framesToCapture
@t0chas
t0chas / CustomEditorBase.cs
Last active March 5, 2024 16:47
Default Custom Inspector-Editor for Unity3D with ReorderableLists for arrays handling
using UnityEngine;
using UnityEditor;
using UnityEditorInternal;
using System.Collections.Generic;
using UnityEditor.AnimatedValues;
[CustomEditor(typeof(UnityEngine.Object), true, isFallback = true)]
[CanEditMultipleObjects]
public class CustomEditorBase : Editor
{
@MattRix
MattRix / PhysicsFollower.cs
Last active May 7, 2024 09:06
A thing you can use to make a rigidbody move towards a position reliably
using UnityEngine;
using System.Collections;
using System;
[RequireComponent (typeof(Rigidbody))]
public class PhysicsFollower : MonoBehaviour
{
public Transform target;
Rigidbody rb;
/*
Basic Sprite Shader for aligning pixel art to the same grid, based on the Unity Sprite Shader.
Create one Material where you assign the same Pixels Per Unit value you use on your imported Sprites,
then reuse this Material on all appropriate Sprite Renderers.
(You can use Shader.SetGlobalFloat to set that Pixels Per Unit value for all your shaders:
https://docs.unity3d.com/ScriptReference/Shader.SetGlobalFloat.html)
This is not for scaled or rotated artwork. If you need those features, look at low res render textures.
Use this however you want.
@konsfik
konsfik / WaterController.cs
Created March 26, 2017 23:21
Procedural Water Surface, c#, Unity3D
using System.Collections;
using System.Collections.Generic;
using System.Linq; //required inorder to convert list to array
using UnityEngine;
/* Source Code written by Kostas Sfikas, March 2017
Tested with Unity 5.5.0 f3 Pesonal edition*/
[RequireComponent(typeof(MeshFilter))] // making sure that the gameobject has a MeshFilter component
[RequireComponent(typeof(MeshRenderer))] // making sure that the gameobject has a MeshRenderer component
@yasirkula
yasirkula / IAPManager.cs
Created November 4, 2021 14:35
A wrapper script for Unity IAP (In-App Purchases) that can be used for common IAP tasks
using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Purchasing;
using UnityEngine.Purchasing.Security;
public class IAPManager : IStoreListener
{
public enum State { PendingInitialize, Initializing, SuccessfullyInitialized, FailedToInitialize };