Skip to content

Instantly share code, notes, and snippets.

@handcircus
handcircus / DecalMeshProjection.cs
Created May 11, 2018 11:21
Create a decal mesh, based upon projection onto another mesh. Optimised for mobile (so works in forward, rejects invalid triangles to prevent overdraw)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
// Builds a mesh that represents a projected sprite onto another mesh
// Clips unused polys to prevent overdraw
// To use, just create a child game object on the mesh you want to project onto, and assign a sprite
// Currently doesnt support sprite sheets with multiple sprites
public class DecalMeshProjection : MonoBehaviour {
@handcircus
handcircus / unity.rb
Created October 19, 2018 13:51
Fastlane action to build Unity Project - now uses the project version to select from Hub versions (if applicable)
# Adapted from https://gist.github.com/dddnuts/522302dc0b787896ebd103542372f9c1
module Fastlane
module Actions
class UnityAction < Action
def self.run(params)
projectVersionFilePath="#{params[:project_path]}/ProjectSettings/ProjectVersion.txt"
UI.message "Checking project version at #{projectVersionFilePath}"
if !File.exist?(projectVersionFilePath)
UI.error("Can't find project version file")
#!/usr/bin/python
import os.path
import csv
import cjson
import sys
import gzip
import ntpath
def write_event(prefix, event_type, headers, event):
data = prepare_data(headers, event)
using UnityEngine;
using System.Collections;
// Based on work on:
// https://gist.github.com/munkbusiness/9e0a7d41bb9c0eb229fd8f2313941564
// https://gist.github.com/aVolpe/707c8cf46b1bb8dfb363
// https://stackoverflow.com/questions/39651021/vibrate-with-duration-and-pattern/39668630#39668630
/// <summary>
/// Android Vibration support. Uses VibrationEffect on API 26 or above (Android 8)