Skip to content

Instantly share code, notes, and snippets.

@grimmdev
grimmdev / AssetBundleExporter.cs
Last active November 7, 2021 09:16
Wanted to make sure this bad boy doesn't disappear off the interwebs, it makes asset bundles with ease
// AssetBundle Exporter v.1.0
// Copyright (C) 2013 Sergey Taraban <http://staraban.com>
//
// 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:
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARIS
@grimmdev
grimmdev / 2DEnemyController.cs
Last active November 30, 2016 23:11
Detect edges for a simple moving enemy controller and apply movement
using UnityEngine;
using System.Collections;
public class 2DEnemyController : MonoBehaviour {
// should we flip our enemy?
public bool isFlipped = false;
// used for Rotation
private Vector3 r = Vector3.zero;
@grimmdev
grimmdev / RenderToWeb.cs
Created March 28, 2015 01:36
Unity render screen to web page image.
// Copy the function below and put it into your Web Template and build and launch for Web.
//
//function WebRender(base64) {
// console.log(base64);
// var img=document.createElement("img");
// img.alt="Render";
// img.src="data:image/png;base64,"+base64;
// document.body.appendChild(img);
//}
@grimmdev
grimmdev / TransformEditor.cs
Last active August 29, 2015 14:20
TransformEditor HUD for SceneView
// Put this file in the folder Editor
// 2015
// Sean Loper
// TransformEditor 1.1
// HUD For sceneview
using UnityEngine;
using UnityEditor;
using System.Collections;
@grimmdev
grimmdev / HourlyBonus.cs
Created April 29, 2015 07:03
Very simple C# unity static class to check if the user is capable of getting his reward bonus. Easily customizable.
// Sean Loper
// Hourly Bonus Mechanic 1.0
// Very simple to expand and static functions for easy calling
// also simple bool checks with custom hour input.
// You can easily add your own saving and loading function check before
// the calculations of thisTime and lastTime;
using System;
using UnityEngine;
using System.Collections;
@grimmdev
grimmdev / Screenshot.cs
Created May 2, 2015 04:36
Screenshot method using only singular class and static methods for easy calling with no references.
using System;
using UnityEngine;
public class Screenshot {
// basic capture method
public static void Capture(){
string screenshotIMGName = DateTime.Now.ToString();
string subString = screenshotIMGName.Replace ('/','_');
string gypsy = subString.Replace(':','_');
@grimmdev
grimmdev / SiteLock.cs
Created May 14, 2015 03:18
Sitelock Unity3D Web Player
// You'll have to call these functions atleast once, on load of the game just to ensure your work isn't being stolen.
using UnityEngine;
using System.Collections;
public class SiteLock {
public static void WWWLock (string Domain) {
Application.ExternalEval("if(document.location.host != '" + Domain + "') { document.location='" + Domain + "'; }");
}
@grimmdev
grimmdev / ExampleManager.cs
Last active August 29, 2015 14:21
MonoBehaviourUtility for shared instances. The beauty of Singletons.
using UnityEngine;
using System.Collections;
public class ExampleManager : MonoBehaviour
{
static public ExampleManager sharedManager
{
get
{
return MonoBehaviourUtility.GetManager<ExampleManager>( ref _sharedManager );
@grimmdev
grimmdev / Share.cs
Created May 15, 2015 21:07
Simple social network sharing class for any platform.
using UnityEngine;
using System.Collections;
public class Share {
public static void Facebook (string url)
{
Application.OpenURL ("https://www.facebook.com/sharer/sharer.php?u=" + url);
}
@grimmdev
grimmdev / ActionTest.cs
Last active August 29, 2015 14:21
Using the Action Delegate and it's pretty sweet!
using UnityEngine;
using System;
using System.Collections;
public class ActionTest : MonoBehaviour {
// Use this for initialization
private void Awake () {
string url = "http://google.com";
StartCoroutine(WaitForRequest(url,(status)=>{